Commits

Steven! Ragnarök committed b695293

Initial commit.

Comments (0)

Files changed (2)

+The Land of Lisp
+================
+
+*My journey through the Land of Lisp. Guided by Conrad Barski*
+
+This is a collection, initially of games from the book [The Land of Lisp][1] but
+I'll also be using this as my noodling repo for GNU CLISP and SBCL code.
+
+Where I remember I note that the games come from the book and my say something
+about a specific lesson or computer science concept the game showcases, but
+really if you like what you see you should get Conrad's book.
+
+[1]: http://nostarch.com/lisp.htm
+

guess-my-number.lisp

+;;;;;;;;;;;;;;;;;;;;;;
+;; Guess The Number ;;
+;;;;;;;;;;;;;;;;;;;;;;
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+; From Conrad Barski's Land of Lisp ;
+;    http://nostarch.com/lisp.htm   ;
+;      Showcasing Binary Search     ;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defparameter *big* 100)
+
+(defparameter *small* 1)
+
+(defun guess-my-number ()
+  (ash (+ *small* *big*) -1))
+
+(defun smaller ()
+  (setf *big* (1- (guess-my-number)))
+  (guess-my-number))
+
+(defun bigger ()
+  (setf *small* (1+ (guess-my-number)))
+  (guess-my-number))
+
+(defun start-over ()
+  (defparameter *small* 1)
+  (defparameter *big* 100))
+