You are previewing Land of Lisp.

Land of Lisp

Cover of Land of Lisp by Conrad Barski M.D. Published by No Starch Press

Rolling the Dice

I’m sure you’ve probably noticed one obvious flaw in our game so far: Despite the fact that it is called Dice of Doom, it actually is completely devoid of any randomness! The dice are never rolled, and the larger stack will always automatically win, which makes for a pretty lame dice game. Now we’re finally going to rectify this flaw.

In this version of the game, during an attack, both piles of dice are rolled, and whoever rolls the highest number wins the battle. Ties are a victory for the defender. If the attacker loses, that player must surrender all dice from the attacking hex except one.

In the lingo of AI programming, this means we will add chance nodes to our game tree. The way we’re going to implement this is pretty simple. ...

The best content for your career. Discover unlimited learning on demand for around $1/day.