src/hanoi.lisp @ e7c56841f0f4

Jank in qud tier dumping, implement wu
author Steve Losh <steve@stevelosh.com>
date Thu, 01 Feb 2018 22:22:26 -0500
parents 6eccaf72df12
children (none)
(defpackage :sand.hanoi
  (:use
    :cl
    :losh
    :sand.quickutils))

(in-package :sand.hanoi)

(defun move (disc from to)
  (format t "Move disc ~D from ~D to ~D~%" disc from to))

(defun hanoi (n)
  (recursively ((disc n)
                (from 1)
                (to 3)
                (using 2))
    (when (plusp disc)
      (recur (1- disc) from using to)
      (move disc from to)
      (recur (1- disc) using to from)))
  (values))