about summary refs log tree commit diff stats
path: root/lib/Caelum/CLI.rakumod
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2021-04-27 21:49:33 +0530
committerAndinus <andinus@nand.sh>2021-04-27 21:49:33 +0530
commit4b8db3661bf9bac752f099f99577dd836c53fd0d (patch)
treed78e5a7375fdde2906f9d0ed0a4274c4f5464284 /lib/Caelum/CLI.rakumod
parent1e94c64f174f3569c2be653df4d23f9285815d74 (diff)
downloadcaelum-4b8db3661bf9bac752f099f99577dd836c53fd0d.tar.gz
Fix betting, winning logic
- The bet amount can be equal to the wallet.
- Winning logic was flawed.
Diffstat (limited to 'lib/Caelum/CLI.rakumod')
-rw-r--r--lib/Caelum/CLI.rakumod4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Caelum/CLI.rakumod b/lib/Caelum/CLI.rakumod
index a7b1e4f..ab2b6e9 100644
--- a/lib/Caelum/CLI.rakumod
+++ b/lib/Caelum/CLI.rakumod
@@ -36,7 +36,7 @@ multi sub MAIN(
             # Reset points.
             $player.points = 0;
 
-            unless $player.wallet > $bet {
+            unless $player.wallet >= $bet {
                 say "==> Cannot place bet. All amount goes to pot.";
                 $pot += $player.wallet;
                 $player.wallet = 0;
@@ -81,7 +81,7 @@ multi sub MAIN(
             }
         }
 
-        with @players.sort(*.wallet)[0] -> $player {
+        with @players.sort(*.wallet).reverse[0] -> $player {
             say "{$player.name} wins $pot!";
             $player.wallet += $pot;
         }