The 8 ball problem, have a try!

Almost 2 months ago Kasper B. Graversen wrote in his blog about a puzzle that most people with computer science background get it wrong… Here’s how it goes, given 8 identical looking balls where one of them is heavier than the other seven and a scale, identify the one heavier ball using the least number of weightings. You can read about the puzzle at Kasper B. Graversen blog.

In order to simulate this problem I have created a JavaFX game, so before reading the solution have a try at my simulator and try to find the heavier ball.

You can find the code here
Note: You can also download the code from JavaFXExamples at google code.
svn checkout javafxexamples-read-only

Here are few screen shots of the game.

Drag and Drop the ball in the balance, left or right side

When pressing the “Start Balance” button you will see something similar to this screen shot.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s