From cbde4fcde4f0c7fafe29d3a6052c26341641162b Mon Sep 17 00:00:00 2001 From: OMGOMG Date: Wed, 6 Apr 2022 16:40:17 +0200 Subject: [PATCH] make explicit what is alice's bet --- play.bash | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/play.bash b/play.bash index 886a400..41f5994 100755 --- a/play.bash +++ b/play.bash @@ -12,13 +12,14 @@ round=0 # bob's hand is random while read -r prize bob_bet do + alice_bet=$prize printf 'Runde %s: Premie er %s, Alice satser %s, Bob satser %s.\n' \ - "$((++round))" "$prize" "$prize" "$bob_bet" - if ((prize > bob_bet)) + "$((++round))" "$prize" "$alice_bet" "$bob_bet" + if ((alice_bet > bob_bet)) then ((alice_sum += prize)) printf 'Alice vinner %s!\n' "$prize" - elif ((bob_bet > prize)) + elif ((bob_bet > alice_bet)) then ((bob_sum += prize)) printf 'Bob vinner %s!\n' "$prize"