From 25eb685e5efded84e4f28640548169a26367e326 Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Thu, 26 Sep 2019 20:28:28 -0400 Subject: net: ror/ten: Add dice-world-attack-lost. net/ricketyspace/ror/ten/source.rkt --- net/ricketyspace/ror/ten/source.rkt | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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)) + ; ; ; -- cgit v1.2.3