Skip to content

Instantly share code, notes, and snippets.

@sathish316
Created November 29, 2010 21:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sathish316/720680 to your computer and use it in GitHub Desktop.
Save sathish316/720680 to your computer and use it in GitHub Desktop.
Binary search guessing game from Land of Lisp book
(defparameter *small* 1)
(defparameter *big* 100)
(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 ()
(setf *small* 1)
(setf *big* 100)
(guess-my-number))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment