File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programming Diversions and the fly likes marble puzzle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Other » Programming Diversions
Bookmark "marble puzzle" Watch "marble puzzle" New topic
Author

marble puzzle

ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
You have 12 marbles, all looks same but one is either lighter or heavier. You have �two wing weight pane�. Now in three trials, you have to find the odd one.



[ April 20, 2007: Message edited by: ankur rathi ]
Ryan McGuire
Ranch Hand

Joined: Feb 18, 2005
Posts: 1013
    
    3
If I recall correctly, I first solved this puzzle (with donuts instead of marbles ) when I was 12. Here I'll start you off:

Step one:
Weigh donuts... I mean marbles A, B, C and D against E, F, G and H.
Ryan McGuire
Ranch Hand

Joined: Feb 18, 2005
Posts: 1013
    
    3
For those who think this is too easy, let me add a twist to the problem.

Restriction: You have to know what weighings you will do before you start the whole experiment. In other words, you can not use the results of the first weighing to decide which donuts/marbles to weigh in the second or third one.

Here I'll start you off:

Step one:
Weigh donuts... I mean marbles A, B, C and D against E, F, G and H.

I went through quite a few donuts trying to figure this one out.
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
I first heard this with coins, back in college. It's not that the original puzzle is too easy, but it's pretty familiar here. Ryan's revision does offer a new challenge. One solution:

1. Weigh abcd (left) vs. efgh (right)
2. Weigh aeij (left) vs. bcfk (right)
3. Weigh chil (left) vs. abgj (right)

Write > if the left is heavier than the right, < if the right is heavier than the left, and = if they balance. Concatenate these three symbols and look up the result below. A + means the given coin/donut/marble is heavier, and a - means it's lighter. An x means the result is impossible.

<<<: x
<<=: f+
<<>: a-
<=<: g+
<==: d-
<=>: h+
<><: c-
<>=: e+
<>>: b-
=<<: i-
=<=: k+
=<>: j-
==<: l-
===: x
==>: l+
=><: j+
=>=: k-
=>>: i+
><<: b+
><=: e-
><>: c+
>=<: h-
>==: d+
>=>: g-
>><: a+
>>=: f-
>>>: x

So if you get 1. left is heavier, 2. right is heavier, 3. they balance, that's ><=, which maps to e-, which means coin/donut/marble e is lighter.


"I'm not back." - Bill Harding, Twister
pradeep jaladi
Ranch Hand

Joined: Nov 21, 2004
Posts: 65
Hi,

Divide 12 marbles in 6-6. put 6 in one side and remaing six in another let us say if one marble is lesser weigth pick the 6 marbles from the less weigth side and divide six in to 3-3 and weigth again continue the process until 1-1-1 is left. put any 2 out of 3 marbles if they are same reamining marble is weigth less, if any of them is weigth less that will be the weigth less one.


Ex:-

1) 6-6 ( rule out the weigth one)
2) 3-3 ( rule out the weigth one)
3) 1-1-1 ( rule out the original one.)


Pradeep.Jaladi
Ryan McGuire
Ranch Hand

Joined: Feb 18, 2005
Posts: 1013
    
    3
How would your method determine if a marble is too heavy?
[ May 09, 2007: Message edited by: Ryan McGuire ]
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Originally posted by pradeep jaladi:
Hi,

Divide 12 marbles in 6-6. put 6 in one side and remaing six in another let us say if one marble is lesser weigth pick the 6 marbles from the less weigth side and divide six in to 3-3 and weigth again continue the process until 1-1-1 is left. put any 2 out of 3 marbles if they are same reamining marble is weigth less, if any of them is weigth less that will be the weigth less one.


Ex:-

1) 6-6 ( rule out the weigth one)
2) 3-3 ( rule out the weigth one)
3) 1-1-1 ( rule out the original one.)



That�s a kind of universal trick for this kind of problem. But this trick will not work for this problem until we know that the odd marble is either heaver or lighter than others.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: marble puzzle