Puzzles
Moderator: Site Moderator
-
- retired
- Posts: 3243
- Joined: Sat Aug 18, 2007 8:22 am
Puzzles
This is a puzzle/question offered up as an example of the kind of logic problems a software engineer might run into.
There are 3 boxes of fruit: 1 of apples only, 1 of oranges only, and 1 of apples and oranges mixed. Each box is mislabed as to it's contents. Pick one piece of fruit, from one box only, then solve what is in each/all box from that result. Detail the solution in such a way that you can solve it had your result from picking the one piece of fruit been the opposite result (ie., an orange instead of an apple). Again, you are starting by picking one piece of fruit, from one box...not one from each box. And you can't see/sense what's inside the box. Only what piece of fruit you pull out.
We had fun with it at the bar....using our shot glasses to visualize the problem, etc.
There are 3 boxes of fruit: 1 of apples only, 1 of oranges only, and 1 of apples and oranges mixed. Each box is mislabed as to it's contents. Pick one piece of fruit, from one box only, then solve what is in each/all box from that result. Detail the solution in such a way that you can solve it had your result from picking the one piece of fruit been the opposite result (ie., an orange instead of an apple). Again, you are starting by picking one piece of fruit, from one box...not one from each box. And you can't see/sense what's inside the box. Only what piece of fruit you pull out.
We had fun with it at the bar....using our shot glasses to visualize the problem, etc.
-
- retired
- Posts: 3215
- Joined: Tue Mar 03, 2009 4:09 pm
- Location: Auckland, NZ
Re: Puzzles
Bastard. I'll be thinking of that all day now.
Edit, got it now... won't ruin it for others though!
Edit, got it now... won't ruin it for others though!
Three sheets to the wind!
My stuff
My stuff
-
- Swill Maker
- Posts: 194
- Joined: Tue Mar 17, 2009 5:44 pm
Re: Puzzles
Sounds like the kind of logic problem a green grocer might run into to me.This is a puzzle/question offered up as an example of the kind of logic problems a software engineer might run into.
Here's one they ask prospective new hires at MicroSoft:
Why are manholes circular?
If stupidity got us into this mess, then why can't it get us out?
Will Rogers
Will Rogers
-
- Swill Maker
- Posts: 413
- Joined: Tue Sep 14, 2010 4:25 pm
Re: Puzzles
Ok, I give up. Maybe I am the sucker but I don't see how it could be done aside from trick answers like how they smell, their dent patterns or such.
So I just pulled an orange from box 1, what are the contents of all the boxes? I have 4 possibilities on paper. You tell me which is correct.
Back at you. Or Kiwi since you know the answer also.
-Loneswinger
The man-hole one is pretty clear.
So I just pulled an orange from box 1, what are the contents of all the boxes? I have 4 possibilities on paper. You tell me which is correct.
Back at you. Or Kiwi since you know the answer also.
-Loneswinger
The man-hole one is pretty clear.
It's better to learn from other people's mistakes than your own.
-
- retired
- Posts: 3215
- Joined: Tue Mar 03, 2009 4:09 pm
- Location: Auckland, NZ
Re: Puzzles
you haven't given enough info, loneswinger. what was the label on the box you pulled the orange out of?
Three sheets to the wind!
My stuff
My stuff
-
- Angel's Share
- Posts: 13666
- Joined: Sun Dec 23, 2007 8:07 pm
- Location: up north
Re: Puzzles
got it but it only works if they all are marked wrong..and you knew this.
-
- Rumrunner
- Posts: 706
- Joined: Wed Feb 03, 2010 6:11 am
Re: Puzzles
ditto on what dunder said
Daddy used, to say " Any landing you can walk away from is a good one"
Calculations don't mean shit when compared to the real world practical experience of many...RAD 9/2010
Calculations don't mean shit when compared to the real world practical experience of many...RAD 9/2010
-
- Distiller
- Posts: 1283
- Joined: Wed Oct 21, 2009 9:53 am
- Location: Just underneath this group of pixels...;)
Re: Puzzles
Juice them all and ferment...then who the fuck cares?
ScottishBoy
HD Survival in a Nutshell...
Read.Search.Listen.Ask for feedback, you WILL get it. Plastic is always "questionable". Dont hurry. Be Careful. Dont Sell,Tell, or Yell. If you wouldnt serve it to your friends, then it isnt worth keeping.
HD Survival in a Nutshell...
Read.Search.Listen.Ask for feedback, you WILL get it. Plastic is always "questionable". Dont hurry. Be Careful. Dont Sell,Tell, or Yell. If you wouldnt serve it to your friends, then it isnt worth keeping.
- Husker
- retired
- Posts: 5031
- Joined: Thu Aug 17, 2006 1:04 pm
Re: Puzzles
if all boxes are mislabled, then this is a trivlal problem. I have not read past the first reply (of kiwi). But it is trivial. I can answer it now, but will look to see if anyone has posted answer prior
I will rot13 post it though
fryrpg n sehvg sebz gur obk ynoryrq zvkrq. Vs vg vf nccyr, gura gur benatr vf va gur obk znexrq nccyr, naq zvkrq vf va obk znexrq benatr.
Vs gur sehvg cvpxrq sebz zvkrq vf nccyr, gura guvf bar vf nccyr, gur bar znexrq zvkrq vf benatr naq bar znexrq benatr vf zvkrq.
H.
Edit a rot13 convert page is here: http://personal-computer-tutor.com/rot13.htm" onclick="window.open(this.href);return false;" rel="nofollow
Edit, I screwed up the 2nd part. It should have started if the 'other' type fruit was selected (then reverse results). I think I listed the same pick twice. But I am leaving the rot13 alone.
I will rot13 post it though

fryrpg n sehvg sebz gur obk ynoryrq zvkrq. Vs vg vf nccyr, gura gur benatr vf va gur obk znexrq nccyr, naq zvkrq vf va obk znexrq benatr.
Vs gur sehvg cvpxrq sebz zvkrq vf nccyr, gura guvf bar vf nccyr, gur bar znexrq zvkrq vf benatr naq bar znexrq benatr vf zvkrq.
H.
Edit a rot13 convert page is here: http://personal-computer-tutor.com/rot13.htm" onclick="window.open(this.href);return false;" rel="nofollow
Edit, I screwed up the 2nd part. It should have started if the 'other' type fruit was selected (then reverse results). I think I listed the same pick twice. But I am leaving the rot13 alone.
Hillbilly Rebel: Unless you are one of the people on this site who are legalling distilling, keep a low profile, don't tell, don't sell.
-
- Master of Distillation
- Posts: 3017
- Joined: Tue Jan 19, 2010 8:04 pm
- Location: Paradise? Western KY
Re: Puzzles
why did the chicken cross the road
now theres a stumper


now theres a stumper



- Husker
- retired
- Posts: 5031
- Joined: Thu Aug 17, 2006 1:04 pm
Re: Puzzles
About 20 years ago, while driving with my (then) young kids, we figured that question out, when it happened right in front of us. The chicken crosses the road to get to the corn field. We were stopped on the edge of town (grand island NE) by a flock of chickens crossing the road to get to the corn fieldKentucky shinner wrote:why did the chicken cross the road![]()
now theres a stumper![]()
![]()

H.
Hillbilly Rebel: Unless you are one of the people on this site who are legalling distilling, keep a low profile, don't tell, don't sell.
-
- Master of Distillation
- Posts: 3017
- Joined: Tue Jan 19, 2010 8:04 pm
- Location: Paradise? Western KY
Re: Puzzles
Now we all know... Thanks Husker 

-
- retired
- Posts: 3243
- Joined: Sat Aug 18, 2007 8:22 am
Re: Puzzles
You are right Husker...the solution is simple...but understanding the problem is what initially tripped us up when we were trying to find it. Once the parameters are in place and understood...and properly visualized, the solution came pretty quickly:
Solution:
You always start with the box labeled "mixed fruit". Since it's "mislabeled", whatever fruit you pick from it..(apple or orange) has to be either all apples or all oranges. So, now you know that either all apples or all oranges is in the mixed fruit box. We'll solve this for both.
If the fruit you picked from mixed box was an apple then the mixed box contains all apples:
There are 2 mislabed boxes left to solve (all apples and all oranges) and to determine which fruit (oranges or mixed fruit) is in which one. Since the oranges cannot be in the all orange box (it's mislabed), then it has to be in the all apples box. That means the mixed fruit is in the all orange box.
If the fruit you picked from mixed box was an orange then the mixed box contains all oranges:
The apples are in the all orange box. And the mixed fruit is in the all apple box.
There was another simple logic problem/puzzle that a friend presented....in that it represented how to save money/time, etc..for search algorithms. He never gave the solution, and I didn't solve it, but here's the puzzle (I'm sure some somebody out there already knows it)
You have 7 straws. They all weigh exactly the same...except for 'one' straw which is slightly heavier. You could obviously weigh each one and average them to find the heavy one. But, the problem presented was to find the heavy straw in just 2 moves/procedures.
Solution:
You always start with the box labeled "mixed fruit". Since it's "mislabeled", whatever fruit you pick from it..(apple or orange) has to be either all apples or all oranges. So, now you know that either all apples or all oranges is in the mixed fruit box. We'll solve this for both.
If the fruit you picked from mixed box was an apple then the mixed box contains all apples:
There are 2 mislabed boxes left to solve (all apples and all oranges) and to determine which fruit (oranges or mixed fruit) is in which one. Since the oranges cannot be in the all orange box (it's mislabed), then it has to be in the all apples box. That means the mixed fruit is in the all orange box.
If the fruit you picked from mixed box was an orange then the mixed box contains all oranges:
The apples are in the all orange box. And the mixed fruit is in the all apple box.
There was another simple logic problem/puzzle that a friend presented....in that it represented how to save money/time, etc..for search algorithms. He never gave the solution, and I didn't solve it, but here's the puzzle (I'm sure some somebody out there already knows it)
You have 7 straws. They all weigh exactly the same...except for 'one' straw which is slightly heavier. You could obviously weigh each one and average them to find the heavy one. But, the problem presented was to find the heavy straw in just 2 moves/procedures.
Last edited by Usge on Thu Oct 28, 2010 11:26 am, edited 1 time in total.
-
- Swill Maker
- Posts: 413
- Joined: Tue Sep 14, 2010 4:25 pm
Re: Puzzles
Oh sorry. Box 1 was labeled "Yams", Box 2 was labeled "frozen peas", and Box 3 was labeled "nuclear waste".kiwistiller wrote:you haven't given enough info, loneswinger. what was the label on the box you pulled the orange out of?

Even if 'mislabeled' as in still labeled orange, apple, orange/apple, you couldn't do it arbitrarily. You would have to pull from a particular box to get a definitive answer every time. Maybe that was the question, what box do you pull from?
-Loneswinger
It's better to learn from other people's mistakes than your own.
-
- Swill Maker
- Posts: 413
- Joined: Tue Sep 14, 2010 4:25 pm
Re: Puzzles
Always hard to define two-moves. You could put 3 on one side of a balance, 3 on the other. If it balances, it is the odd straw not on the balance. If it doesn't balance, you take the 3 straws from the heavy side, then put 1 on one side of the balance, then one on the other, and same logic applies. If that is considered "two moves" then it is solved.Usge wrote: You have 7 straws. They all weigh exactly the same...except for 'one' straw which is slightly heavier. You could obviously weigh each one and average them to find the heavy one. But, the problem presented was to find the heavy straw in just 2 moves/procedures.
-Loneswinger
It's better to learn from other people's mistakes than your own.
-
- Distiller
- Posts: 1283
- Joined: Wed Oct 21, 2009 9:53 am
- Location: Just underneath this group of pixels...;)
Re: Puzzles
Because it was Carbon Arc welded to the robot!Kentucky shinner wrote:why did the chicken cross the road![]()
ScottishBoy
HD Survival in a Nutshell...
Read.Search.Listen.Ask for feedback, you WILL get it. Plastic is always "questionable". Dont hurry. Be Careful. Dont Sell,Tell, or Yell. If you wouldnt serve it to your friends, then it isnt worth keeping.
HD Survival in a Nutshell...
Read.Search.Listen.Ask for feedback, you WILL get it. Plastic is always "questionable". Dont hurry. Be Careful. Dont Sell,Tell, or Yell. If you wouldnt serve it to your friends, then it isnt worth keeping.
-
- retired
- Posts: 3243
- Joined: Sat Aug 18, 2007 8:22 am
Re: Puzzles
That sounds good to me Loneswingerloneswinger wrote:Always hard to define two-moves. You could put 3 on one side of a balance, 3 on the other. If it balances, it is the odd straw not on the balance. If it doesn't balance, you take the 3 straws from the heavy side, then put 1 on one side of the balance, then one on the other, and same logic applies. If that is considered "two moves" then it is solved.Usge wrote: You have 7 straws. They all weigh exactly the same...except for 'one' straw which is slightly heavier. You could obviously weigh each one and average them to find the heavy one. But, the problem presented was to find the heavy straw in just 2 moves/procedures.
-Loneswinger

-
- Angel's Share
- Posts: 4545
- Joined: Tue Aug 09, 2005 11:55 pm
- Location: Bullamakanka, Oztrailya
Re: Puzzles
ScottishBoy wrote:Juice them all and ferment...then who the fuck cares?





Simple potstiller. Slow, single run.
(50 litre, propane heated pot still. Coil in bucket condenser - No thermometer, No carbon)
The Reading Lounge AND the Rules We Live By should be compulsory reading
Cumudgeon and loving it.
(50 litre, propane heated pot still. Coil in bucket condenser - No thermometer, No carbon)
The Reading Lounge AND the Rules We Live By should be compulsory reading
Cumudgeon and loving it.
- Husker
- retired
- Posts: 5031
- Joined: Thu Aug 17, 2006 1:04 pm
Re: Puzzles
That is the answer. It is a 'modified' binary search type algorithm (divide and conquer) . One out of 7 times it can be done in 1 step. The other 6 out of 7 times requires 2 steps.loneswinger wrote:Always hard to define two-moves. You could put 3 on one side of a balance, 3 on the other. If it balances, it is the odd straw not on the balance. If it doesn't balance, you take the 3 straws from the heavy side, then put 1 on one side of the balance, then one on the other, and same logic applies. If that is considered "two moves" then it is solved.Usge wrote: You have 7 straws. They all weigh exactly the same...except for 'one' straw which is slightly heavier. You could obviously weigh each one and average them to find the heavy one. But, the problem presented was to find the heavy straw in just 2 moves/procedures.
-Loneswinger
H.
Hillbilly Rebel: Unless you are one of the people on this site who are legalling distilling, keep a low profile, don't tell, don't sell.
-
- retired
- Posts: 20865
- Joined: Wed Dec 19, 2007 4:46 pm
- Location: New York, USA
Re: Puzzles
Husker is right... Those of us who program know that with a binary search on a sorted data set will have to be sampled a maximum of 8 times in order to find the record you are searching for... Dropping the record count below 8 records (straws) reduces the maximum sampling iterations required, sorted or not... Just boring computer geek crap to most, I'm sure...
- Husker
- retired
- Posts: 5031
- Joined: Thu Aug 17, 2006 1:04 pm
Re: Puzzles
Instead of a binary search, this is actually a ternary search (3 vs 2), but it is the same thought process. It is ternary, since there is 3 groupings that one of them is picked from, and continued from there. For a binary search, the set is divided into 2 groups, and one group is selected, and the process is repeated over and over, until only 1 item is uniquely identified.
In a binary search, the working set is cut in half (rounded down) each step. In the ternary search, the working data is cut into 1/3 (rounded down).
The same puzzle could find the 1 heavy straw, out of 9 straws in 2 steps. The puzzle is done the way that it is, so that it is harder to 'see' the method needed. If it was an even 9, then the triple divide and conquer is easier for some people to see (or have that 'ah-ha' moment). Starting from 7 straws makes 'the obvious' a little less obvious. If it was 9 straws with 1 heavy, it would always take 2 steps.
H.
PS, often times it sux to be a computer nerd, and to actually think using these forms of logic. I find it much harder to actually explain to others, than it is to actually build the logic needed, into a rigid procedural language. English flows in a way that is not conducive to writing logic.
In a binary search, the working set is cut in half (rounded down) each step. In the ternary search, the working data is cut into 1/3 (rounded down).
The same puzzle could find the 1 heavy straw, out of 9 straws in 2 steps. The puzzle is done the way that it is, so that it is harder to 'see' the method needed. If it was an even 9, then the triple divide and conquer is easier for some people to see (or have that 'ah-ha' moment). Starting from 7 straws makes 'the obvious' a little less obvious. If it was 9 straws with 1 heavy, it would always take 2 steps.
H.
PS, often times it sux to be a computer nerd, and to actually think using these forms of logic. I find it much harder to actually explain to others, than it is to actually build the logic needed, into a rigid procedural language. English flows in a way that is not conducive to writing logic.
Hillbilly Rebel: Unless you are one of the people on this site who are legalling distilling, keep a low profile, don't tell, don't sell.
-
- retired
- Posts: 3243
- Joined: Sat Aug 18, 2007 8:22 am
Re: Puzzles
Not a binary type, but we had fun toying with it over beer/drinks. 

-
- retired
- Posts: 3111
- Joined: Sun Jun 14, 2009 2:14 pm
- Location: If I told you, I'd have to Kill You.
Re: Puzzles
What the hell? Im lost......Husker wrote:Instead of a binary search, this is actually a ternary search (3 vs 2), but it is the same thought process. It is ternary, since there is 3 groupings that one of them is picked from, and continued from there. For a binary search, the set is divided into 2 groups, and one group is selected, and the process is repeated over and over, until only 1 item is uniquely identified.
In a binary search, the working set is cut in half (rounded down) each step. In the ternary search, the working data is cut into 1/3 (rounded down).
The same puzzle could find the 1 heavy straw, out of 9 straws in 2 steps. The puzzle is done the way that it is, so that it is harder to 'see' the method needed. If it was an even 9, then the triple divide and conquer is easier for some people to see (or have that 'ah-ha' moment). Starting from 7 straws makes 'the obvious' a little less obvious. If it was 9 straws with 1 heavy, it would always take 2 steps.
H.
PS, often times it sux to be a computer nerd, and to actually think using these forms of logic. I find it much harder to actually explain to others, than it is to actually build the logic needed, into a rigid procedural language. English flows in a way that is not conducive to writing logic.

Screw it, Im goin to my girlfriends house to check my wash.

-Control Freak-
AKA MulekickerHDbrownNose
AKA MulekickerHDbrownNose
-
- retired
- Posts: 3111
- Joined: Sun Jun 14, 2009 2:14 pm
- Location: If I told you, I'd have to Kill You.
Re: Puzzles
umm, you dumbass, you cant weld a chicken.ScottishBoy wrote:Because it was Carbon Arc welded to the robot!Kentucky shinner wrote:why did the chicken cross the road![]()

-Control Freak-
AKA MulekickerHDbrownNose
AKA MulekickerHDbrownNose