BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Simple LabVIEW Puzzle Challenge

OK here is one solution attached below.  You need to find the center of your screen by checking your monitor resolution and dividing by 2 and adjusting to catch the pixels changing.  You need to run the "GetPixel Color to Morse Code.vi" then the ".-.vi".  You still need to translate the final product into Old English.

 

Or if you prefer to solve it yourself you can use the following key:

 

Dot = Red, 300ms

Dash = Green, 100ms

Space Between Letters = White, 300ms 

Space Between Words = Black, 700ms

 

Regards,

-SS



0 Kudos
Message 131 of 192
(4,073 Views)

For some reason I always come back to pi.  I was sent the following tidbit about the Feynman point.

 

So I was going through various math sites wondering what a simple algorithm was for generating the 1st 1000 digits of pi and came across this little chunk of c code from here:

 

long k=4e3,p,a[337],q,t=1e3;
  main(j){for(;a[j=q=0]+=2,--k;)
  for(p=1+2*k;j<337;q=a[j]*k+q%p*t,a[j++]=q/p)
  k!=j>2?:printf("%.3d",a[j-2]%t+q/p/t);}

Well I haven't been able to change it into LabVIEW (it does work in C) but thought it would make for a nice simple puzzle challege for the folks that know both C and LabVIEW.

 

So the challege is to convert the above C into LabVIEW.

 

As usual the prize is to pick the next puzzle if you choose.  Oh and before I forget... the password to the last puzzle is "MorseCode2012" and you will have to abort the vi with "ctrl+." to use it.

 

Regards,

 

-SS

 



0 Kudos
Message 132 of 192
(4,024 Views)

@ShotSimon wrote:

For some reason I always come back to pi.  I was sent the following tidbit about the Feynman point.

 

So I was going through various math sites wondering what a simple algorithm was for generating the 1st 1000 digits of pi and came across this little chunk of c code from here:

 

long k=4e3,p,a[337],q,t=1e3;
  main(j){for(;a[j=q=0]+=2,--k;)
  for(p=1+2*k;j<337;q=a[j]*k+q%p*t,a[j++]=q/p)
  k!=j>2?:printf("%.3d",a[j-2]%t+q/p/t);}

Well I haven't been able to change it into LabVIEW (it does work in C) but thought it would make for a nice simple puzzle challege for the folks that know both C and LabVIEW.

 

So the challege is to convert the above C into LabVIEW.

 

As usual the prize is to pick the next puzzle if you choose.  Oh and before I forget... the password to the last puzzle is "MorseCode2012" and you will have to abort the vi with "ctrl+." to use it.

 

Regards,

 

-SS

 


Wow, there's some messed up syntax in that.  That's what could make it a challenge.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 133 of 192
(4,017 Views)

I win, that looks like a variation of the Pi spigot I posted here:

 

http://forums.ni.com/t5/BreakPoint/Happy-Pi-Day/m-p/1090569#M11227

 

Not nearly as concise, almost as unreadable!

0 Kudos
Message 134 of 192
(4,009 Views)

Darrin.K,

 

That is very cool that you did that already.  Somehow I missed it on the forums search...oh well.  I saw a Monte Carlo example but really like this one better.  Very nice code and allows you to find the Feynman point quickly.  I would love to see if Altenbach could speed it up. 

 

I have another puzzle based on a game I played over the weekend called "Fill or Bust".  Using LabVIEW show the odds of throwing at least one, (1 OR a 5) with either 1, 2, 3, 4, or 5 dice.

 

Regards,

 

-SS



0 Kudos
Message 135 of 192
(3,986 Views)

In case anyone wants to see a G implementation of the Pi spigot C code:

 

long k=4e3,p,a[337],q,t=1e3;
  main(j){for(;a[j=q=0]+=2,--k;)
  for(p=1+2*k;j<337;q=a[j]*k+q%p*t,a[j++]=q/p)
  k!=j>2?:printf("%.3d",a[j-2]%t+q/p/t);}

 

PiSpigotFromC.png

 

Mine is faster (spitting out 4 digits at a time) and actually includes the 3 in the beginning (notice how I had to tack it on).

 

Some annoying abuse of the ternary operator there, along with the comma operator, and I rarely put more than my increment/decrement in the third slot of a for expression....

0 Kudos
Message 136 of 192
(3,936 Views)

@ShotSimon wrote:

I have another puzzle based on a game I played over the weekend called "Fill or Bust".  Using LabVIEW show the odds of throwing at least one, (1 OR a 5) with either 1, 2, 3, 4, or 5 dice. 

 



FillorBust.png

0 Kudos
Message 137 of 192
(3,933 Views)

Darin,

 

Wow, Can you explain that solution?  It is correct but I don't understand it:)

 

Thanks,

 

-SS

 

 



0 Kudos
Message 138 of 192
(3,904 Views)

@ShotSimon wrote:

Darin,

 

Wow, Can you explain that solution?  It is correct but I don't understand it:)

 

Thanks,

 

-SS

 

 


The first step in probability is to ask the correct question, in particular consider whether the inverse question is easier.  For example, let's say there are three dice and let P(#1,#5) be the probability of #1 1s and #5 5s.  The question you asked is what is P(1,0)+P(2,0)+P(3,0)+P(0,1)+P(0,2)+P(0,3)+P(1,1)+P(1,2)+P(1,3)+P(2,1)+P(2,2)+P(2,3)+P(3,1)+P(3,2)+P(3,3).  Yuk, especially with more than three dice.  Let's instead ask the question: What is the probability of rolling no 1's and no 5's, P(0,0)?  This is pretty easy, you have N dice, for each die there are 4 out of 6 results which are neither 1 nor 5.  P(0,0) is then (4/6)^N = (2/3)^N.  Then the probability you are looking for is simply 1-P(0,0), essentially saying the probability of more than 1 1 or 5 is 1 minus the probability of no 1s or 5s.

 

(I was actually playing a small joke as I figured the intent was to use LV to simulate the results and I used LV to implement the math).

0 Kudos
Message 139 of 192
(3,896 Views)

Darin,

 

I solved this problem with LabVIEW using simulation (i.e throwing the dice a couple thousand times) and with C with nested for loops counting all possible combinations with 1 or 5 divided total combinations.  Your solution is by far the slickest example of problem solving I have seen in a while..Throwing pure math at a problem is no joke and shows it's power is amazing.

 

Thanks,

 

-SS

 

P.S. Got any simple puzzles that have stumped you?



0 Kudos
Message 140 of 192
(3,878 Views)