Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site utcsri.UUCP Path: utzoo!utcsri!petera From: petera@utcsri.UUCP (Smith) Newsgroups: net.micro Subject: PC-LISP PACKAGE (article 12 of 13) Message-ID: <2649@utcsri.UUCP> Date: Sun, 27-Apr-86 14:38:01 EDT Article-I.D.: utcsri.2649 Posted: Sun Apr 27 14:38:01 1986 Date-Received: Sun, 27-Apr-86 15:42:40 EDT Distribution: net Organization: CSRI, University of Toronto Lines: 35 ;; HANOI.L for PC-LISP.EXE (V2.10) ;; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ;; Another program that was found with some XLISP stuff and modified to ;; run under PC-LISP. Again I do not know who the author is. ;; ;; Peter Ashwood-Smith ;; April 2nd, 1986 ;; Good ol towers of hanoi ;; ;; Usage: ;; (hanoi ) ;; - an integer the number of discs (defun hanoi(n) ( transfer 'A 'B 'C n )) (defun print-move ( from to ) (patom '|Move Disk From |) (patom from) (patom '| To |) (patom to) (patom (ascii 10)) ) (defun transfer ( from to via n ) (cond ((equal n 1) (print-move from to )) (t (prog () (transfer from via to (- n 1)) (print-move from to) (transfer via to from (- n 1)))))) (hanoi 4) ; start things going