Tuesday, April 14, 2009

Tutorial: Puzzle 1-2

There seems to be some misunderstanding concerning the rules of the game.  Either the instructions need to be reworked or I need to develop an in-game tutorial.  In either case, I'll work on that.  In the meantime, what follows is a step-by-step tutorial on solving Puzzle 1-2.

The initial configuration of the board is as follows:

The first constraint that we'll look at is the (1) token.  There are a total of 2 units of distance from the (1) to the (6).  However, the total distance measured out of the (1) token must be exactly one, not two.  To fix this, we'll need to place a token between the (1) and the (6) to decrease the distance.  Now, the total distance from the (1) to the nearest piece is one -- exactly what we wanted.  The (1) token is colored in green to show that the constraint has been satisfied.  The board now looks like:

Next, we'll take care of the (7) token.  We'll need a total of 7 units of distance to satisify this token's constraint.  So far, there is already a distance of 3 units from the (7) to the token we just placed in the previous step.  This means we are short 4 more units of distance.  We cannot place a token in the top-most row.  Otherwise the constraint on the (1) token will no longer be satisfied.  We can place a token to the left of (7) without breaking anything else.  This will give us a total distance now of 4 units (1 to the left, and 3 to the right).  We are still short 3 more units of distance.  We'll place a token three units below the (7).  Now we have solved the constraint: 1 unit of distance to left, plus 3 units of distance to the right, plus 3 units of distance down, for a total of 7 units.

To finish the puzzle up, we'll take a look at the last token on the board, the (6) token.  There is a distance of one from the (6) to the token we placed in the first move.  We will need to increase the total distance since we are short five units.  We can place a piece all the way to the left of the (6) in the first column, this will give us four more units of distance.  To finish it off, we can place a token directly below the six.  So, 4 units to the left, plus 1 unit up, plus 1 unit down, totals to 6 and the puzzle is solved.

All puzzles were designed so that there is a unique solution in some sense.  You could always add additional tokens to the board that don't affect anything.  However, there is always one unique base solution for each puzzle.

I hope this helps clear things up some.