diff options
author | rsiddharth <s@ricketyspace.net> | 2020-02-05 23:26:13 -0500 |
---|---|---|
committer | rsiddharth <s@ricketyspace.net> | 2020-02-05 23:26:13 -0500 |
commit | 210bc03d7c142f2ec3438f7e11a7f2e70287c3b4 (patch) | |
tree | 2b76d37f16df5946c2c5412e50182b4a93bbe257 | |
parent | 0b0add81b068721aa92ce612d2c16588499f6e7b (diff) |
ror: Update twelve/source.rkt.
Display different help text at the bottom when it's the AI's turn.
-rw-r--r-- | net/ricketyspace/ror/twelve/source.rkt | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/net/ricketyspace/ror/twelve/source.rkt b/net/ricketyspace/ror/twelve/source.rkt index 70d83b4..cc6c366 100644 --- a/net/ricketyspace/ror/twelve/source.rkt +++ b/net/ricketyspace/ror/twelve/source.rkt @@ -180,12 +180,15 @@ (define TEXT-COLOR "black") (define INSTRUCT "← and → to move among territories, <enter> to mark, <d> to unmark, and <p> to pass") +(define AI-INSTRUCT + "press any key to let the AI play") (define AI-TURN "It's the Mighty AI's turn") (define YOUR-TURN "It's your turn") (define INFO-X-OFFSET 180) (define INFO-Y-OFFSET 50) (define INSTRUCTIONS (text INSTRUCT TEXT-SIZE TEXT-COLOR)) +(define AI-INSTRUCTIONS (text AI-INSTRUCT TEXT-SIZE TEXT-COLOR)) (define WIDTH (+ (image-width INSTRUCTIONS) 50)) (define HEIGHT 600) (define (PLAIN) @@ -194,11 +197,15 @@ (set! WIDTH (+ (max iw bw) 50)) (set! HEIGHT (+ (* SIDE 2 BOARD) 50)) (empty-scene WIDTH HEIGHT)) -(define (ISCENE) +(define (ISCENE w) (define mt (PLAIN)) (when (or (> (image-width mt) 1280) (> (image-height mt) 800)) (error 'scene "it is impossible to draw a ~s x ~s game scene for a 1280 x 800 laptop screen" (image-width mt) (image-height mt))) - (place-image INSTRUCTIONS (* .5 WIDTH) (* .9 HEIGHT) mt)) + (place-image + (if (= (game-player (dice-world-gt w)) AI) + AI-INSTRUCTIONS + INSTRUCTIONS) + (* .5 WIDTH) (* .9 HEIGHT) mt)) ; ; @@ -261,7 +268,7 @@ (define (draw-dice-world w) (add-player-info (game-player (dice-world-gt w)) - (add-winning-probability w (add-board-to-scene w (ISCENE))))) + (add-winning-probability w (add-board-to-scene w (ISCENE w))))) ;; DiceWorld -> Boolean ;; is it possible to play any moves from this world state? |