Errata for Dice of Doom

Skip to first unread message

Simon Nicolussi

May 17, 2015, 5:32:48 PM5/17/15
Page 423 says that (up to that point) "the number of reinforcements
always equals the number of captured opponent dice, minus one". The
code doesn't agree, however: dice in an attack's destination hex are
also awarded if the attack failed. That's probably a simple copy and
paste error and easily fixed:

--- dice_of_doom_v4.lisp
+++ dice_of_doom_v4.lisp
@@ -25,7 +25,7 @@
(game-tree (board-attack-fail board cur-player src dst (dice src))
- (+ spare-dice (dice dst))
+ spare-dice
(make-lazy (neighbors src)))

My change, alas, triggers another bug. Written way back on page 333,
the add-new-dice function expects a non-negative spare-dice argument.
Its caller, the add-passing-move function, subtracts 1 from the number
of dice captured in the preceding moves, which was greater than 0 (one
or more attacks have to take place, none of which can fail).

This changed with the introduction of dice rolling: attacks might fail
now, which means that a player might pass without having captured even
one single die. The add-passing-move function then calls add-new-dice,
using -1 as the spare-dice argument, and add-new-dice hands out dice
until it either traversed the board or spare-dice reached 0 (which
won't happen when starting with -1). I suggest the following fix:

--- dice_of_doom_v1.lisp
+++ dice_of_doom_v1.lisp
@@ -204,7 +204,7 @@

(defun add-new-dice (board player spare-dice)
(labels ((f (lst n acc)
- (cond ((zerop n) (append (reverse acc) lst))
+ (cond ((not (plusp n)) (append (reverse acc) lst))
((null lst) (reverse acc))
(t (let ((cur-player (caar lst))
(cur-dice (cadar lst)))

Simon Nicolussi <>
Reply all
Reply to author
0 new messages