| summaryrefslogtreecommitdiff | 
diff options
| author | nsensfel <SpamShield0@noot-noot.org> | 2020-08-31 11:15:42 +0200 | 
|---|---|---|
| committer | nsensfel <SpamShield0@noot-noot.org> | 2020-08-31 11:15:42 +0200 | 
| commit | 55b0873d35189e6e6f1f36670b9687bfc227da25 (patch) | |
| tree | 4ea5392b29b4d60c4ce6339001c7ce60379d2d30 | |
| parent | 0ebd88472a6bd195f2f5ff34165c7fa79053105d (diff) | |
Fixes unbinding within hierarchical contexts.
And a few blackjack things.
| -rw-r--r-- | data/examples/blackjack/play.fate | 52 | ||||
| -rw-r--r-- | src/core/src/tonkadur/wyrd/v1/compiler/util/registers/RegisterContext.java | 4 | 
2 files changed, 40 insertions, 16 deletions
| 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)           )        )     ) diff --git a/src/core/src/tonkadur/wyrd/v1/compiler/util/registers/RegisterContext.java b/src/core/src/tonkadur/wyrd/v1/compiler/util/registers/RegisterContext.java index 090f596..1baabb7 100644 --- a/src/core/src/tonkadur/wyrd/v1/compiler/util/registers/RegisterContext.java +++ b/src/core/src/tonkadur/wyrd/v1/compiler/util/registers/RegisterContext.java @@ -148,6 +148,10 @@ class RegisterContext     {        release(aliased_registers.get(name));        aliased_registers.remove(name); +      if (!hierarchical_aliases.isEmpty()) +      { +         hierarchical_aliases.peekFirst().remove(name); +      }     }     public void push_hierarchical_instruction_level () | 


