November 2010
Intermediate to advanced
504 pages
12h 45m
English
Now that we’ve discussed some of the philosophy of Lisp and have a running CLISP environment, we’re ready to write some actual Lisp code in the form of a simple game.
This first game we’ll write is pretty much the simplest game imaginable. It’s the classic guess-my-number game.
In this game, you pick a number from 1 to 100, and the computer has to guess it.
The following shows what game play might look like if you pick the number 23. The computer starts by guessing 50, and with each successive guess, you enter (smaller) or (bigger) until the computer guesses your number.
>(guess-my-number)50 >(smaller)25 >(smaller)12 >(bigger)18 >(bigger)21 >(bigger)23
To create this game, ...
Read now
Unlock full access