*       COSC3308        Example-2               10/24/2002
*       Hanoi Tower Problem
        define('Hanoi(disks,from,to,via)local1,local2')
        ;*  There should be no space inside the function prototype
        define(  'Printt(disks,from,to)')
        disk = 2
repeat  output =
        output = "THE NUMBER OF DISKS IS::" disk
        output =
        hanoi(disk,'A','B','C')
        disk = le(disk,5) disk + 1              :s(repeat)f(done)
        ;* Otherwise done as disk > 5 already
Hanoi   eq(disks,1) Printt(disks,from,to)       :s(return)
        ;* there are more than one disk to move.
        hanoi(disks - 1, from, via, to)
        Printt( disks,from,to)
        hanoi(  disks - 1, via, to, from)         :(Return)
Printt  output = "Move Disk: " disks " From " From " To " to    :(return)
Done    Output =
        Output = "THE LAST NUMBER OF DISKS IS: " disk
End