What You've Learned

In this chapter, we put together a simple engine for a text adventure game. Along the way, you learned the following:

  • A game world can be represented by a mathematical graph, consisting of nodes for the places the player can visit and edges for the paths between these places.

  • You can store these nodes in an association list (alist) called *nodes*. This alist allows you to look up properties of a node/place by using its name. In the case of our game, the property we’re storing is a description of each node/place.

  • You use the assoc function to look up a key (location name in our example) in an alist.

  • Quasiquoting is a technique that allows you to insert small bits of computer code into larger pieces of data.

  • Some Lisp functions accept other functions as arguments. These are called higher-order functions. The mapcar function is the most popular higher-order function in Common Lisp.

  • To replace a value from an alist, you push new items onto the list. Only the most recent value will be reported by the assoc function.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.79.65