Task

Solve the   Towers of Hanoi   problem with recursion.




            NORMAL MODE IS INTEGER
            DIMENSION LIST(100)
            SET LIST TO LIST
 
            VECTOR VALUES MOVFMT = 
          0  $20HMOVE DISK FROM POLE ,I1,S1,8HTO POLE ,I1*$
 
            INTERNAL FUNCTION(DUMMY)
            ENTRY TO MOVE.
LOOP        NUM = NUM - 1
            WHENEVER NUM.E.0
                PRINT FORMAT MOVFMT,FROM,DEST
            OTHERWISE
                SAVE RETURN
                SAVE DATA NUM,FROM,VIA,DEST
                TEMP=DEST
                DEST=VIA
                VIA=TEMP
                MOVE.(0)
                RESTORE DATA NUM,FROM,VIA,DEST
                RESTORE RETURN
                PRINT FORMAT MOVFMT,FROM,DEST
                TEMP=FROM
                FROM=VIA
                VIA=TEMP
                TRANSFER TO LOOP
            END OF CONDITIONAL
            FUNCTION RETURN
            END OF FUNCTION
 
            NUM  = 4
            FROM = 1
            VIA  = 2
            DEST = 3
            MOVE.(0)
 
            END OF PROGRAM
 