HANOI (located in \TOOLKIT\SAMPLES\OS2\HANOI) demonstrates a multithreaded application with the familiar "towers of Hanoi" puzzle. When the sample program is started, you see three poles (A, B, and C). Initially, pole A has on it a stack of disks starting with the largest disks on the bottom and succeeding smaller disks on the top. The main thread handles the PM interface and lets the you start or stop the Hanoi routine. It also lets you reset the number of working disks. The second thread is created when the Start item is selected from the Options menu. This thread starts the recursive execution of the Hanoi algorithm, runs in the background, and moves and paints the disks. All disks end up on pole C.


[Back] [Next]