<<Previous  Next>>  
Introduction
The puzzle The algorithm Program Design

The simple
algorithm is easy to follow, but it may not be the "best" (i.e., the one that
uses the least number of moves) to get to the solution.
More than likely, moving the "1" to the topleft corner, then the "2", and so on... is not the "optimal" way to solve the puzzle. Suppose one started with the "solved state": Suppose, one "moves" only the outer blocks, as follow:

by doing this, one has
"turned " the outermost ring of blocks counterclockwise:
After a few more similar counterclockwise moves, we might get: If one does not notice the pattern of the blocks, one might try to move the "1" back up the current column, instead of using a clockwise movement. 
What is the "best" solution? That
depends on what one values. One might want the one that takes a human
being the least amount of time, one that takes a computer the least
amount of time, or something else.
We are trying to get the solution that uses the least number of moves. In some contexts, this is not the best: for instance, if it takes ages to figure out a "least move" solution, and what one really values is the speed of the solution. 