; function plays Towers of Hanoi Game ; Input is the size of of the tower to be ; moved, the peg where the disks are located, ; the peg where the disks are to be moved to, ; and the extra peg to be used in moving (define (move-tower size from to extra) (cond ((= size 0) #t) (else (move-tower (- size 1) from extra to) (move from to) (move-tower (- size 1) extra to from) ))) ; the primitive move function for the ; towers of hanoi. This function captures ; moving one disk from peg from to peg to. ; This function has a side effect of printing. (define (move from to) (newline) (display "move top disk from ") (display from) (display " to ") (display to))