Tower of Hanoi  -  Adesktop puzzle

by Alan Wrigley

The Tower of Hanoi consists of a tower of blocks, each smaller than the one below, which must be moved to a new site one block at a time. The catch is that there is a limited number of sites, and a block cannot be placed on top of a block smaller than itself.

The program can be run from the RISC User menu system, or by clicking on the icon in the RISC User master menu system. This will open a window with two programs, double-clicking on the Hanoi icon in a directory viewer will run the program. A window opens showing three sites, with a tower of coloured blocks on the left-hand site. The tower must be moved to one of the other sites.

Blocks are moved by dragging the topmost block on any site to a new position. Only the topmost block can be moved at any time. If you try to drop the block onto a block which is smaller than itself, a beep will sound and the move will be disallowed. If a valid move is made, the block will take up its new position. A move counter is displayed in the upper part of the window.

When the complete tower has been re-sited, the move counter will indicate that you have finished the puzzle.

Clicking Menu over the window opens a menu with two options. Info leads to a standard info box. New game resets the move counter to zero and moves the complete tower back to the left-hand site ready to start a new game.

The BASIC file included is from Douglas Boote, as described in this month's magazine on page 57.

Copyright  RISC User 1995
