BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Rube Goldberg Code

(Seen here)

 

I am still trying to figure out the logic and the input requirements where we:

 

  • take a string and convert it to a byte array
  • take a scalar DBL
  • Do a logical AND on the byte array with the DBL (even the compiler is puzzled and just puts coercion dots on all inputs!)
  • Take that bitwise result and convert it back to a string
  • See if the string is "0" or "1" and proceed accordingly.

VoodooMath.png

 

And yes, they read the same local in all cases of the case structure and also right before it. Once is probably enough unless we expect different results.

Message 1981 of 2,571
(10,852 Views)

@altenbach wrote:
  • Do a logical AND on the byte array with the DBL (even the compiler is puzzled and just puts coercion dots on all inputs!)

What the compile does is the only thing that makes sense to me: the AND doesn't accept floats, so it converts the dbl to I32. Then the [U8] is converted to [I32] to fit it. Output is [I32].

 

Good one. Totally unclear.

0 Kudos
Message 1982 of 2,571
(10,846 Views)

Does this qualify? No code posted, but from the description it's Rube Goldberg Code.

0 Kudos
Message 1983 of 2,571
(10,842 Views)

(seen here)

 

There are many ways to create a column matrix, some are just easier than others:

 

Matrix.png

0 Kudos
Message 1984 of 2,571
(10,732 Views)

This might be a new record in insanity! (seen here)

 

Apparently we need a huge 2D arrangement of almost 1000 scalar colorboxes, convert each to the red U8 component, build them into a 1D array using a aztec pyramid of deeply stacked sequence structures, just to reshape it later into the original geometric arrangement.

 

(I spare you from looking at the entire diagram, this is just the tip of the iceberg that set's the overall tone. You can guess how the rest looks like 🐵

 

ColorsColorsEverywhere.png

 

Using an array of colorboxes as the input, here is functionally identical code (still meaningless, but functionally equivalent :D)

 

ColorBoxArray.png

Message 1985 of 2,571
(10,710 Views)

While this isn't exactly OVERLY complicated, it's something I shamefully admit to doing when I first started teaching myself LV. I didn't know about Case structures, and needed something to execute or not based on a boolean, so here's my janky boolean solution:

 

ghetto bool.png

Message 1986 of 2,571
(10,637 Views)

+1 for the VI naming! 😄

Actually it does work this way for sure! You just need to be careful, and use shift registers for all wires going through the FOR loop, for the False case. We could call this structure as a "single case Case"...

0 Kudos
Message 1987 of 2,571
(10,615 Views)

@BertMcMahan wrote:

While this isn't exactly OVERLY complicated, it's something I shamefully admit to doing when I first started teaching myself LV. I didn't know about Case structures, and needed something to execute or not based on a boolean, so here's my janky boolean solution:

 

ghetto bool.png


Not bad, not bad at all. It saves a click to see what's in the other case, to make sure or to find out it's empty!

0 Kudos
Message 1988 of 2,571
(10,600 Views)

All I see is a coercion dot. Smiley Indifferent

PaulG.

LabVIEW versions 5.0 - 2020

“All programmers are optimists”
― Frederick P. Brooks Jr.
Message 1989 of 2,571
(10,577 Views)

wiebe@CARYAwiebe@CARAYA wrote:

 

Not bad, not bad at all. It saves a click to see what's in the other case, to make sure or to find out it's empty!


Just hope you don't lose errors down stream by not handling the case of a for loop executing 0 times.

Matt J | National Instruments | CLA
0 Kudos
Message 1990 of 2,571
(10,550 Views)