home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / m / me_cd25.zip / MC2MUTT.ZIP / HANOI.MUT < prev    next >
Text File  |  1992-11-09  |  535b  |  23 lines

  1. ; Good ol towers of hanoi
  2. ;    converted from xlisp to Mutt 12/86 C Durland
  3. ; Usage:
  4. ;      (hanoi <n>)
  5. ;          <n> - number of discs
  6.  
  7. (const NUMBER    0x03)
  8.  
  9. (defun
  10.   print-move (from to) { (msg "Move Disk From " from " To " to) }
  11.   transfer (from to via)(int n)
  12.   {
  13.     (if (== n 1)(print-move from to)
  14.     {
  15.       (transfer from via to (- n 1))
  16.       (print-move from to)
  17.       (transfer via to from (- n 1))
  18.     })
  19.   }
  20.   hanoi MAIN
  21.     { (transfer "A" "B" "C" (convert-to NUMBER  (ask "n = ")))(msg "done.") }
  22. )
  23.