From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

BreakPoint

cancel
Showing results for 
Search instead for 
Did you mean: 

Simple LabVIEW Puzzle Challenge

I am a big fan of Games Magazine and have always enjoyed puzzles, so I decided to start a simple fun thread about puzzles.  This is a perfect way to learn some tips and tricks using LabVIEW.

 

Since this is a programming challenge credit should be giving to speed...but I think presentation should also factor in.

 

The first puzzle, is a puzzle about crossing a rickety bridge in the dark.  It was originally published in Games Magazine but I do not have the original reference.  Four people named 1, 2, 5, and 10 have to quickly cross the bridge.  They have a single flashlight and everyone needs to get safely across.  1 takes one minute, 2 takes two minutes, 5 takes five minutes, and 10 takes ten minutes.  Only two people are allowed across at any one time, and you must walk the speed of the slower person. 

 

Example:

 

We will have 1 and 2 go across first = 2 mins.

1 goes back = 1 min.

1 and 5 goes across = 5 mins.

 for a total of 8 mins. so far.

 

The trick is to do this in  the minimum time possible (and no you don't get to throw the flashlight). 

There are solutions on the web but I would suggest if you've never seen this puzzle to avoid looking up the answer since solving it is more fun.

 

The trick is to be creative and have fun and I look forward to seeing your solutions. 

 

Regards,

 

-SS

 

 



Message 1 of 192
(13,588 Views)
It sounds like an interesting idea to try to solve these kinds of puzzles using LabVIEW.  But I would recommend finding the original writeup on this particular puzzle.  It sounds like this puzzle has a pretty easy solution that the 1 minute guy be the one who leads the others across and brings the flashlight back.  There must be some other catch to this described in the puzzle writeup that makes this more of a puzzle.Smiley Surprised
Message 2 of 192
(13,582 Views)

ShotSimon wrote:

Only two people are allowed across at any one time, and you must walk the speed of the slower person. 


Ravens Fan,

Does that line clear things up a bitSmiley Wink  I did try to find the original source but no luck, I'll keep looking.

 

I was afraid I would confuse people.  Let me know if it's clear now?

 

-SS



Message 3 of 192
(13,577 Views)
Not really. Smiley Sad Ravens Fan is right. In your description you stated that only two people are allowed to cross, but in your example you indicate that 1 goes back alone. This would seem to contradict the rules of crossing. There must be something missing from the puzzle, otherwise there's no reason not to have 1 take the trip back each time, and there would be only one (no pun intended) solution to the "puzzle".
Message 4 of 192
(13,571 Views)

Okay, it is not as trivial as I thought.  (I was at work, and work was distracting me  Smiley Very Happy)  I thought the easy solution was  1&8 across (8) 1 back (1) 1&4 across (4) 1 back (1)  1 and 2 across (2),  total 16 minutes.

 

Then I realized the trick was to try to minimize the times of the going over even if it costs you some time on the going back.  And the only way to do that was to merge the 4 guy with the 8 guy, but never let one of them walk back because you've already had 1 & 2 go across ahead of them.

 

1 & 2 across (2)  1 back (1)  4 & 8 across (8)  2 back (2)  1&2 across (2), total 15 minutes.

 

Is there any better solution?

 

Of course this could be done in LabVIEW or any programming language.  Probably generating a table that sets up all the permutations of over and back for the different people, doing the calculations, then sorting the list to find the one that has the  lowest total.

 

The other possibility is that it is an interactive game where a user clicks on each person, the program determines whether it is a valid move, logs it and totals the time.  Then it could keep track of the lowest time to date and the corresponding moves and allows the player to try again.

 

I had forgotten about Games magazine.  My sister used to get it back when we were kids.  I would read it and do the puzzles after she was done with it.  They had a lot of really good logic puzzles that sometimes seemed downright impossible.  Is the magazine still around?

Message Edited by Ravens Fan on 09-08-2008 09:24 PM
Message 5 of 192
(13,563 Views)

smercurio_fc wrote:
"In your description you stated that only two people are allowed to cross, but in your example you indicate that 1 goes back alone. This would seem to contradict the rules of crossing."


Ravens Fan wrote:

"1&8 across (8) 1 back (1) 1&4 across (4) 1 back (1)  1 and 2 across (2),  total 16 minutes."


Sorry for the late reply, Enthusiast's are a tough crowdSmiley Very Happy

 

OK some clarification is needed.  The idea is that the bridge can only handle at most two people.  One person can certainly cross alone and needs to in order to bring the flashlight safely back to the others.  You need the flashlight for safety as it is a dark rickety bridgeSmiley Wink

 

The actual description of this puzzle was something like two sentences so you have to make assumptions about not cheating, etc.

 

Raven's Fan is on the right track but were he came up with 4 and 8 I'll never know.  It's interesting to note with software it could be any four positive integers.  It would be interesting to see which give the best result for example.  For now lets stick with 1, 2, 5, and 10.

 

Also if you get a solution I was hoping people would post in LabVIEW.

 

I can tell you the answer which was also in the original problem and it is "17".  There is no doubt most people can solve this on paper in a few minutes but I think you will enjoy the solution.  In a way it is not common sense.  For example 1 is not the person who is used the most, as most people would think.

 

Enjoy, I will post a solution once I feel people have had an adequate go at itSmiley Very Happy

 

-SS 

 

 

Message Edited by ShotSimon on 09-09-2008 09:51 AM


Message 6 of 192
(13,528 Views)
Ravens Fan already provided the solution. Adapting his numbers to 5 and 10 results in 17 minutes.

___________________
Try to take over the world!
Message 7 of 192
(13,525 Views)

I have no idea where I got 1, 2, 4, and 8 from either.Smiley Surprised  I think went back to read the original message I saw the 8 total minutes in the example and must have run with that.

I must have started thinking in binary numbers, 1, 2, 4, 8Smiley Happy

 

My original guess should have been 

 

1&10 across (10) 1 back (1) 1&5 across (5) 1 back (1)  1 and 2 across (2),  total 19 minutes.

 

and the correct guess as tst said:

 

1 & 2 across (2)  1 back (1)  5 & 10 across (10)  2 back (2)  1&2 across (2), total 17 minutes.

 

The other correct answer would be 2 coming back first and 1 coming back 2nd which would be the same total time.

Message Edited by Ravens Fan on 09-09-2008 11:30 AM
Message 8 of 192
(13,517 Views)

You guys are cracking me upSmiley Very Happy

 

I'm looking for a LabVIEW solution for people to show off there creativity and coding skills, not for someone to post the solution.

 

Part of the fun with puzzles is to see how others solve it, even if you already know the solution. 

 

-SS 



Message 9 of 192
(13,509 Views)

I did post a couple of ideas in reply 5.  But I don't feel like putting in all the effort to actually code something up.  Too many projects at work and at home I should be doing.

 

Which were you thinking of as the challenge, LV program to solve and finding the solution?  Or a LV program as a game to help a person to discover the solution.?

Message 10 of 192
(13,504 Views)