From 3d9c302faed5d88e2a70928c086119d87c156509 Mon Sep 17 00:00:00 2001 From: TLSM Date: Fri, 20 May 2022 23:08:20 -0400 Subject: [PATCH] Blackjack: add five card charlie rule. --- files/helpers/blackjack.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/files/helpers/blackjack.py b/files/helpers/blackjack.py index 6b08d90d5..d560aad86 100644 --- a/files/helpers/blackjack.py +++ b/files/helpers/blackjack.py @@ -93,10 +93,14 @@ def player_hit(from_comment, did_double_down=False): if player_value == -1: status = 'bust' apply_game_result(from_comment, wager, status, kind) + elif len(player_hand) >= 5: + status = 'won' + apply_game_result(from_comment, wager, status, kind) from_comment.blackjack_result = format_all(player_hand, dealer_hand, deck, status, wager, kind, int(is_insured)) - if (did_double_down or player_value == 21): player_stayed(from_comment) + if (did_double_down or player_value == 21) and status == 'active': + player_stayed(from_comment) def player_stayed(from_comment): player_hand, dealer_hand, deck, status, wager, kind, is_insured = from_comment.blackjack_result.split("_")