This program plays the Tower of Hanoi puzzle in GRAPHIC
mode, illustrating recursive programming on the TI-85.
----begin documentation----
This program shows and solves the well-known Tower of
Hanoi puzzle in GRAPHIC mode.  For text mode, see
the companion program group TwrHanoi.85g

There are two parts; TwGHanoi and suGHanMv.  The first sets
up the game, the second is a recursive subroutine to move
the disks.

The Tower of Hanoi puzzle is as follows:  There are three
vertical pegs, usually attached to a board.  On the middle
peg are stacked several disks of decreasing radius (of
course each disk has a hole in its center for the peg):


      |            |            |
      |           -|-           |      >A tower of Hanoi
      |          --|--          |      >puzzle with 5
      |         ---|---         |      >disks.
      |        ----|----        |
      |       -----|-----       |
#########################################

The object is simple:  move the tower of disks to another
peg, given two restrictions:  a) You may only move ONE disk
at a time, i.e. only one disk may be un-pegged at any time,
and b) you may never put a larger disk atop a smaller one.

This problem is often used in introductory math or computing
courses to illustrate recursion (why this is so is left as
an exercise; watch how the program solves the problem).

When the program is run, it asks for the number of disks
you wish to start with (up to 9).  Unlike the text version,
there is no input for delay time; the program is slow enough
already, taking about 20 minutes to run using 9 disks (but
only about 1:20 with 5 disks.)

The program then draws the pegs and disks, and after a brief
delay, the disks move from peg to peg, one at a time, with
no disk ever over a smaller disk.

Programming notes: The list H keeps track of how tall each
stack is.  The matrix "Disk" keeps track of what disk
is in which position. The list C stores the (horizontal)
center of each stack.
	The TI-85 will allow recursive program calls and
correctly maintains the program's flow of control, but
does not allow for local variables.  To simulate local vari-
ables, we use the lists FR, TO, and N.

The real variable D keeps track of the depth of recursion we
are currently at; at level D, we move N(D) disks from peg
FR(D) to peg TO(D).  Each time the subroutine is called re-
cursively, D is incremented.  Each time a subroutine ter-
minates, D is decremented.

Written by Prof. Mark Janeba
Dept. of Math
Willamette University
Salem, OR 97301
e-mail: mjaneba@willamette.edu


