diff options
author | rsiddharth <s@ricketyspace.net> | 2019-09-26 20:28:28 -0400 |
---|---|---|
committer | rsiddharth <s@ricketyspace.net> | 2019-09-26 20:28:28 -0400 |
commit | 25eb685e5efded84e4f28640548169a26367e326 (patch) | |
tree | c757c10b00420e4573588ea23b9623e56d09e8a6 | |
parent | 70f921d266de4dab51052a7306b7732808428531 (diff) |
net: ror/ten: Add dice-world-attack-lost.
net/ricketyspace/ror/ten/source.rkt
-rw-r--r-- | net/ricketyspace/ror/ten/source.rkt | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/net/ricketyspace/ror/ten/source.rkt b/net/ricketyspace/ror/ten/source.rkt index b4fb6f2..8cb98dc 100644 --- a/net/ricketyspace/ror/ten/source.rkt +++ b/net/ricketyspace/ror/ten/source.rkt @@ -547,6 +547,19 @@ (define dst-defend (sum (roll-dice (territory-dice dst-t)))) (if (> src-attack dst-defend) #t #f)) +;; DiceWorld Territory -> DiceWorld +;; generate dice world for the case where player +;; loses the dice attack +(define (dice-world-attack-lost w src-t) + (define src (territory-index src-t)) + (define player (territory-player src-t)) + (define newb (for/list ([t (dice-world-board w)]) + (define idx (territory-index t)) + (cond [(= idx src) (territory-set-dice t 1)] + [else t]))) + (define new-gt (game-tree newb player 0)) + (dice-world #f newb new-gt)) + ; ; ; |