
13.6 Programming Activity 2: The Towers of Hanoi 977
Figure 13.18
An Intermediate Position
in the Animation
Task Instructions
■
In the file HanoiClient.java, the recursiveTOfH method header is:
public void recursiveTOfH( int numDisks, int fromTower,
int toTower, int useTower )
This method takes four parameters: numDisks, representing the
number of disks to be moved, and 3 ints representing the tower to
move the disks from, the tower to move the disks to, and the tower
to use to accomplish that task of moving numDisks disks from
tower fromTower to tower toTower. For instance, with five disks,
our method call in the main method is:
recursiveTOfH( 5, 0, 2, 1 ...