From 55b0873d35189e6e6f1f36670b9687bfc227da25 Mon Sep 17 00:00:00 2001 From: nsensfel Date: Mon, 31 Aug 2020 11:15:42 +0200 Subject: Fixes unbinding within hierarchical contexts. And a few blackjack things. --- data/examples/blackjack/play.fate | 52 +++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 16 deletions(-) (limited to 'data') diff --git a/data/examples/blackjack/play.fate b/data/examples/blackjack/play.fate index 4c2913f..8504afa 100644 --- a/data/examples/blackjack/play.fate +++ b/data/examples/blackjack/play.fate @@ -16,9 +16,12 @@ (local card new_card) (if (not (var has_played)) - (text_effect action_description - Sitting yourself at a table, you see someone rushing to set up the - cards and manage the game. + ( + (text_effect action_description + Sitting yourself at a table, you see someone rushing to set up the + cards and manage the game. + ) + (set has_played (true)) ) ) (if (= (var player.money) 0) @@ -74,6 +77,7 @@ (visit initial_draw) (clear dealer_hand) + (clear player.hand) (newline) Interesting. Would you like to go again? @@ -102,23 +106,39 @@ (visit compute_score (ptr player.hand) (ptr player_score)) (if (= (var dealer_score) 21) - (ifelse (= (var player_score) 21) - ( + ( + (text_effect action_description + The dealer reveals their full hand: + ) + (foreach dealer_hand card (text_effect action_description - The dealer looks very surprised. + (newline) + * The (var card.name), worth + (if_else (= (var card.number) 1) + (text 1 or 11 points. ) + (text (var card.score) points. ) + ) ) - (newline) - Double Blackjack! A tie, then. - (done) ) - ( - (text_effect action_description - The dealer looks surprised, but happy. + (newline) + (ifelse (= (var player_score) 21) + ( + (text_effect action_description + The dealer looks very surprised. + ) + (newline) + Double Blackjack! A tie, then. + (done) + ) + ( + (text_effect action_description + The dealer looks surprised, but happy. + ) + (newline) + Blackjack! Looks like I win, this time. + (visit money_loss (var bet)) + (done) ) - (newline) - Blackjack! Looks like I win, this time. - (visit money_loss (var bet)) - (done) ) ) ) -- cgit v1.2.3-70-g09d2