Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

6. Interacting with the World: Reading a... > Trying Out Our Fancy New Game Interf...

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

  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint