Trying Out Our Fancy New Game Interface

We have now completed all the pieces needed for a custom REPL for our game engine. Simply call the game-repl function and explore our new game world. Remember that we will be expanding this engine into a full game, with additional commands, in Chapter 17.

> (game-repl)
look
You are in the living-room. A wizard is snoring loudly on the couch. There is
 a door going west from here. There is a ladder going upstairs from here. You
 see a whiskey on the floor. You see a bucket on the floor.
walk west
You are in a beautiful garden. There is a well in front of you. There is a
 door going east from here. You see a frog on the floor. You see a chain on
 the floor.
pickup chain
You are now carrying the chain
scratch head
I do not know that command.
pickup chicken
You cannot get that.
walk east
You are in the living-room. A wizard is snoring loudly on the couch. There is
 a door going west from here. There is a ladder going upstairs from here. You
 see a whiskey on the floor. You see a bucket on the floor.
walk upstairs
You are in the attic. There is a giant welding torch in the corner. There is a
 ladder going downstairs from here.
inventory
Items- chain
walk china
You cannot go that way.
walk downstairs
You are in the living-room. A wizard is snoring loudly on the couch. There is
 a door going west from here. There is a ladder going upstairs from here. You
 see a whiskey on the floor. You see a bucket on the floor.
pickup bucket
You are now carrying the bucket
look
You are in the living-room. A wizard is snoring loudly on the couch. There is
 a door going west from here. There is a ladder going upstairs from here. You
 see a whiskey on the floor.
quit

Success! We now have an extremely flexible text game engine. It can be expanded and debugged within the Lisp REPL. It also has a fully customizable interface to offer the player a seamless text adventure experience. As we put it together, you saw some mind-bending Lisp techniques that let us construct this engine with a minimum of filler code or other overhead.

image with no caption
..................Content has been hidden....................

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