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

15. Dice of Doom, a Game Written in the ... > Implementing Dice of Doom, Version 1

Implementing Dice of Doom, Version 1

Let’s start coding this game in Lisp. As we discussed in the previous chapter, this game will contain both clean, functional code and dirty, imperative code. You’ll be able to tell in which category a block of code fits by the “clean/functional” or “dirty/imperative” icon next to it.

Defining Some Global Variables

First, we’ll create some global variables that define the basic parameters for our game:

 (defparameter *num-players* 2)
 (defparameter *max-dice* 3)
 (defparameter *board-size* 2)
 (defparameter *board-hexnum* (* *board-size* *board-size*))

We’re stating that there will be two players , that the maximum number of dice on a square is three , and that the board will be 2-by-2 . In later versions of Dice of Doom, we’ll increase all of these parameters, to allow for a more challenging game.


  

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