(defun guess(times)
(format t "your guess: ")
(let ((input (read)))
(if (> input number)
(progn
(format t "The number is smaller~%")
(guess(+ times 1))))
(if (< input number)
(progn
(format t "The number is bigger~%")
(guess(+ times 1))))
(if (= input number)
(if report
(progn
(setq report nil)
(format t "It took you ~D tries to find the number." times))))))
(defvar number)
(defvar report)
(format t "Guess on a number between 1 and 100~%")
(setq *random-state* (make-random-state t))
(setq number (random 100))
(setq report t)
(guess 1)