summaryrefslogtreecommitdiffstats
path: root/net/ricketyspace
diff options
context:
space:
mode:
Diffstat (limited to 'net/ricketyspace')
-rw-r--r--net/ricketyspace/ror/ten/source.rkt9
1 files changed, 8 insertions, 1 deletions
diff --git a/net/ricketyspace/ror/ten/source.rkt b/net/ricketyspace/ror/ten/source.rkt
index 8cb98dc..71c73b4 100644
--- a/net/ricketyspace/ror/ten/source.rkt
+++ b/net/ricketyspace/ror/ten/source.rkt
@@ -521,7 +521,14 @@
(define feasible (game-moves (dice-world-gt w)))
(define attack (list source target))
(define next (find-move feasible attack))
- (if next (dice-world #f (game-board next) next) w))
+ (define src-t (findf (lambda (t) (= (territory-index t) source))
+ (dice-world-board w)))
+ (define dst-t (findf (lambda (t) (= (territory-index t) target))
+ (dice-world-board w)))
+ (define win? (dice-attack-win src-t dst-t))
+ (cond [(not next) w]
+ [win? (dice-world #f (game-board next) next)]
+ [else (dice-world-attack-lost w src-t)]))
;; [List-of Moves] [or '() [List Natural Natural]] -> [or #f Game-tree]
;; find the move from the current list of moves