From 0ebd88472a6bd195f2f5ff34165c7fa79053105d Mon Sep 17 00:00:00 2001 From: Nathanael Sensfelder Date: Mon, 31 Aug 2020 00:44:25 +0200 Subject: Adds more list instr, Blackjack example. --- data/examples/blackjack/global.fate | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 data/examples/blackjack/global.fate (limited to 'data/examples/blackjack/global.fate') diff --git a/data/examples/blackjack/global.fate b/data/examples/blackjack/global.fate new file mode 100644 index 0000000..9c10c9f --- /dev/null +++ b/data/examples/blackjack/global.fate @@ -0,0 +1,36 @@ +(fate_version 1) + +(require player.fate) + +(global player player) + +(global (lambda text (int)) coins_word) + +(set coins_word + (lambda ((int i)) + (if_else (= (var i) 1) + (text a single coin ) + (text (var i) coins ) + ) + ) +) + +(declare_text_effect action_description) + +(define_sequence money_acquisition ((int amount)) + (set player.money (+ (var player.money) (var amount))) + (if (> (var amount) 0) + (text_effect action_description + You acquired (eval coins_word (var amount))! + ) + ) +) + +(define_sequence money_loss ((int amount)) + (set player.money (- (var player.money) (var amount))) + (if (> (var amount) 0) + (text_effect action_description + You lost (eval coins_word (var amount)). + ) + ) +) -- cgit v1.2.3-70-g09d2