feat(blackjack): implement 3-step Devil's Gambit auto-showdown, Deity AI & UI overhaul
This commit is contained in:
parent
163a3665d2
commit
8c9db3631e
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -19,6 +19,7 @@ class BlackjackEngine:
|
||||||
self.pot: int = 0
|
self.pot: int = 0
|
||||||
self.highest_bet: int = 0
|
self.highest_bet: int = 0
|
||||||
self.raises_in_round: int = 0
|
self.raises_in_round: int = 0
|
||||||
|
self.cycle_card_drawn: bool = False
|
||||||
self.state: str = "PRE_DEAL"
|
self.state: str = "PRE_DEAL"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
@ -46,6 +47,7 @@ class BlackjackEngine:
|
||||||
"pot": self.pot,
|
"pot": self.pot,
|
||||||
"highest_bet": self.highest_bet,
|
"highest_bet": self.highest_bet,
|
||||||
"raises_in_round": self.raises_in_round,
|
"raises_in_round": self.raises_in_round,
|
||||||
|
"cycle_card_drawn": self.cycle_card_drawn,
|
||||||
"state": self.state,
|
"state": self.state,
|
||||||
"player_hands": [
|
"player_hands": [
|
||||||
{
|
{
|
||||||
|
|
@ -87,6 +89,7 @@ class BlackjackEngine:
|
||||||
self.pot = data["pot"]
|
self.pot = data["pot"]
|
||||||
self.highest_bet = data["highest_bet"]
|
self.highest_bet = data["highest_bet"]
|
||||||
self.raises_in_round = data.get("raises_in_round", 0)
|
self.raises_in_round = data.get("raises_in_round", 0)
|
||||||
|
self.cycle_card_drawn = bool(data.get("cycle_card_drawn", False))
|
||||||
self.state = data["state"]
|
self.state = data["state"]
|
||||||
|
|
||||||
self.player_hands = [
|
self.player_hands = [
|
||||||
|
|
@ -112,7 +115,7 @@ class BlackjackEngine:
|
||||||
gold=bd["gold"],
|
gold=bd["gold"],
|
||||||
hand=self._list_to_cards(bd["hand"]),
|
hand=self._list_to_cards(bd["hand"]),
|
||||||
bet_in_pot=bd["bet_in_pot"],
|
bet_in_pot=bd["bet_in_pot"],
|
||||||
cards_locked=bd.get("cards_locked", bd.get("ready", False)),
|
cards_locked=bd.get("cards_locked", False),
|
||||||
busted=bd["busted"],
|
busted=bd["busted"],
|
||||||
folded=bd["folded"],
|
folded=bd["folded"],
|
||||||
doubled=bd.get("doubled", False),
|
doubled=bd.get("doubled", False),
|
||||||
|
|
@ -137,6 +140,7 @@ class BlackjackEngine:
|
||||||
self.pot = p_ante
|
self.pot = p_ante
|
||||||
self.highest_bet = p_ante
|
self.highest_bet = p_ante
|
||||||
self.raises_in_round = 0
|
self.raises_in_round = 0
|
||||||
|
self.cycle_card_drawn = False
|
||||||
|
|
||||||
p_cards = [self.deck.draw(), self.deck.draw()]
|
p_cards = [self.deck.draw(), self.deck.draw()]
|
||||||
p_val, _ = HandEvaluator.evaluate(p_cards)
|
p_val, _ = HandEvaluator.evaluate(p_cards)
|
||||||
|
|
@ -182,7 +186,6 @@ class BlackjackEngine:
|
||||||
return wallet_gold >= self.highest_bet
|
return wallet_gold >= self.highest_bet
|
||||||
|
|
||||||
def split_player_hand(self) -> int:
|
def split_player_hand(self) -> int:
|
||||||
"""Teilt das Paar in 2 separate Hände auf und platziert den zweiten Einsatz in den Pot."""
|
|
||||||
orig = self.player_hands[0]
|
orig = self.player_hands[0]
|
||||||
second_bet = self.highest_bet
|
second_bet = self.highest_bet
|
||||||
c1, c2 = orig.cards[0], orig.cards[1]
|
c1, c2 = orig.cards[0], orig.cards[1]
|
||||||
|
|
@ -208,6 +211,7 @@ class BlackjackEngine:
|
||||||
)
|
)
|
||||||
self.player_hands = [h1, h2]
|
self.player_hands = [h1, h2]
|
||||||
self.pot += second_bet
|
self.pot += second_bet
|
||||||
|
self.cycle_card_drawn = True
|
||||||
return second_bet
|
return second_bet
|
||||||
|
|
||||||
def get_double_down_cost(self, hand_idx: int) -> int:
|
def get_double_down_cost(self, hand_idx: int) -> int:
|
||||||
|
|
@ -215,9 +219,9 @@ class BlackjackEngine:
|
||||||
target_bet = max(self.highest_bet, h.bet_in_pot) * 2
|
target_bet = max(self.highest_bet, h.bet_in_pot) * 2
|
||||||
return max(0, target_bet - h.bet_in_pot)
|
return max(0, target_bet - h.bet_in_pot)
|
||||||
|
|
||||||
def can_double_down(self, hand_idx: int, wallet_gold: int, already_drew_this_turn: bool) -> bool:
|
def can_double_down(self, hand_idx: int, wallet_gold: int, already_drew_this_turn: bool = False) -> bool:
|
||||||
h = self.player_hands[hand_idx]
|
h = self.player_hands[hand_idx]
|
||||||
if not h.is_active_in_pot or h.cards_locked or already_drew_this_turn or len(h.cards) != 2:
|
if not h.is_active_in_pot or h.cards_locked or h.doubled or already_drew_this_turn or len(h.cards) != 2:
|
||||||
return False
|
return False
|
||||||
val, _ = HandEvaluator.evaluate(h.cards)
|
val, _ = HandEvaluator.evaluate(h.cards)
|
||||||
if val >= BJ_TARGET_SCORE:
|
if val >= BJ_TARGET_SCORE:
|
||||||
|
|
@ -226,14 +230,12 @@ class BlackjackEngine:
|
||||||
return cost > 0 and wallet_gold >= cost
|
return cost > 0 and wallet_gold >= cost
|
||||||
|
|
||||||
def double_down_player_hand(self, hand_idx: int) -> tuple[int, Card]:
|
def double_down_player_hand(self, hand_idx: int) -> tuple[int, Card]:
|
||||||
"""Verdoppelt den Einsatz, zieht genau 1 Karte und sperrt die Hand."""
|
|
||||||
cost = self.get_double_down_cost(hand_idx)
|
cost = self.get_double_down_cost(hand_idx)
|
||||||
paid = self.player_add_gold_to_pot(hand_idx, cost)
|
paid = self.player_add_gold_to_pot(hand_idx, cost)
|
||||||
h = self.player_hands[hand_idx]
|
h = self.player_hands[hand_idx]
|
||||||
card = self.player_draw_card(hand_idx)
|
card = self.player_draw_card(hand_idx)
|
||||||
h.doubled = True
|
h.doubled = True
|
||||||
h.cards_locked = True
|
h.cards_locked = True
|
||||||
h.acted_once = True
|
|
||||||
return paid, card
|
return paid, card
|
||||||
|
|
||||||
def player_add_gold_to_pot(self, hand_idx: int, amount: int) -> int:
|
def player_add_gold_to_pot(self, hand_idx: int, amount: int) -> int:
|
||||||
|
|
@ -252,11 +254,11 @@ class BlackjackEngine:
|
||||||
h = self.player_hands[hand_idx]
|
h = self.player_hands[hand_idx]
|
||||||
card = self.deck.draw()
|
card = self.deck.draw()
|
||||||
h.cards.append(card)
|
h.cards.append(card)
|
||||||
|
self.cycle_card_drawn = True
|
||||||
val, _ = HandEvaluator.evaluate(h.cards)
|
val, _ = HandEvaluator.evaluate(h.cards)
|
||||||
if val > BJ_TARGET_SCORE:
|
if val > BJ_TARGET_SCORE:
|
||||||
h.busted = True
|
h.busted = True
|
||||||
h.cards_locked = True
|
h.cards_locked = True
|
||||||
h.acted_once = True
|
|
||||||
elif val == BJ_TARGET_SCORE:
|
elif val == BJ_TARGET_SCORE:
|
||||||
h.cards_locked = True
|
h.cards_locked = True
|
||||||
return card
|
return card
|
||||||
|
|
@ -277,38 +279,25 @@ class BlackjackEngine:
|
||||||
def bot_draw_card(self, bot: BlackjackBotSeat) -> Card:
|
def bot_draw_card(self, bot: BlackjackBotSeat) -> Card:
|
||||||
card = self.deck.draw()
|
card = self.deck.draw()
|
||||||
bot.hand.append(card)
|
bot.hand.append(card)
|
||||||
|
self.cycle_card_drawn = True
|
||||||
val, _ = HandEvaluator.evaluate(bot.hand)
|
val, _ = HandEvaluator.evaluate(bot.hand)
|
||||||
if val > BJ_TARGET_SCORE:
|
if val > BJ_TARGET_SCORE:
|
||||||
bot.busted = True
|
bot.busted = True
|
||||||
bot.cards_locked = True
|
bot.cards_locked = True
|
||||||
bot.acted_once = True
|
|
||||||
elif val == BJ_TARGET_SCORE:
|
elif val == BJ_TARGET_SCORE:
|
||||||
bot.cards_locked = True
|
bot.cards_locked = True
|
||||||
return card
|
return card
|
||||||
|
|
||||||
# --- Zug- & Abschluss-Prüfungen ---
|
# --- Umlauf- & Ausgleichs-Prüfungen ---
|
||||||
def player_hand_needs_turn(self, hand: PlayerHand, wallet_gold: int) -> bool:
|
def has_unsettled_bets(self, bots: list[BlackjackBotSeat], player_wallet_gold: int) -> bool:
|
||||||
if not hand.is_active_in_pot:
|
if player_wallet_gold > 0:
|
||||||
return False
|
for h in self.player_hands:
|
||||||
needs_call = (hand.bet_in_pot < self.highest_bet and wallet_gold > 0)
|
if h.is_active_in_pot and h.bet_in_pot < self.highest_bet:
|
||||||
return (not hand.acted_once) or (not hand.cards_locked) or needs_call
|
return True
|
||||||
|
|
||||||
def bot_needs_turn(self, bot: BlackjackBotSeat) -> bool:
|
|
||||||
if not bot.is_active_in_pot:
|
|
||||||
return False
|
|
||||||
needs_call = (bot.bet_in_pot < self.highest_bet and bot.gold > 0)
|
|
||||||
return (not bot.acted_once) or (not bot.cards_locked) or needs_call
|
|
||||||
|
|
||||||
def is_everyone_finished(self, bots: list[BlackjackBotSeat], player_wallet_gold: int) -> bool:
|
|
||||||
if not self.any_contender_alive(bots):
|
|
||||||
return True
|
|
||||||
for h in self.player_hands:
|
|
||||||
if self.player_hand_needs_turn(h, player_wallet_gold):
|
|
||||||
return False
|
|
||||||
for b in bots:
|
for b in bots:
|
||||||
if self.bot_needs_turn(b):
|
if b.is_active_in_pot and b.gold > 0 and b.bet_in_pot < self.highest_bet:
|
||||||
return False
|
return True
|
||||||
return True
|
return False
|
||||||
|
|
||||||
def any_contender_alive(self, bots: list[BlackjackBotSeat]) -> bool:
|
def any_contender_alive(self, bots: list[BlackjackBotSeat]) -> bool:
|
||||||
return self.any_player_hand_active or any(b.is_active_in_pot for b in bots)
|
return self.any_player_hand_active or any(b.is_active_in_pot for b in bots)
|
||||||
|
|
@ -327,7 +316,6 @@ class BlackjackEngine:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _hand_rank(cards: list[Card], is_split: bool = False) -> tuple[int, int]:
|
def _hand_rank(cards: list[Card], is_split: bool = False) -> tuple[int, int]:
|
||||||
rank = HandEvaluator.showdown_rank(cards)
|
rank = HandEvaluator.showdown_rank(cards)
|
||||||
# Gesplittete 2-Karten-21 zählt regulär als 21 statt Natural Blackjack
|
|
||||||
if is_split and rank == (2, 21):
|
if is_split and rank == (2, 21):
|
||||||
return (1, 21)
|
return (1, 21)
|
||||||
return rank
|
return rank
|
||||||
|
|
@ -336,7 +324,6 @@ class BlackjackEngine:
|
||||||
self.state = "SHOWDOWN"
|
self.state = "SHOWDOWN"
|
||||||
total_p_bet = self.total_player_bet
|
total_p_bet = self.total_player_bet
|
||||||
|
|
||||||
# Solo-Modus ohne Bots (Spielerhände direkt gegen die Bank)
|
|
||||||
if not bots:
|
if not bots:
|
||||||
active_p_hands = [h for h in self.player_hands if h.is_active_in_pot]
|
active_p_hands = [h for h in self.player_hands if h.is_active_in_pot]
|
||||||
if not active_p_hands:
|
if not active_p_hands:
|
||||||
|
|
@ -367,7 +354,6 @@ class BlackjackEngine:
|
||||||
"bot_gains": [],
|
"bot_gains": [],
|
||||||
}
|
}
|
||||||
|
|
||||||
# Multi-Player Vegas-Pot Modus
|
|
||||||
contenders: list[tuple[str, object, tuple[int, int]]] = []
|
contenders: list[tuple[str, object, tuple[int, int]]] = []
|
||||||
for h in self.player_hands:
|
for h in self.player_hands:
|
||||||
if h.is_active_in_pot:
|
if h.is_active_in_pot:
|
||||||
|
|
|
||||||
|
|
@ -5,16 +5,15 @@ from games.blackjack.models.bot_seat import BlackjackBotSeat
|
||||||
from games.blackjack.models.hand_evaluator import HandEvaluator
|
from games.blackjack.models.hand_evaluator import HandEvaluator
|
||||||
from models.card import Card
|
from models.card import Card
|
||||||
from resources.code_res.game_constants import (
|
from resources.code_res.game_constants import (
|
||||||
ACE_RANK, BJ_MAX_RAISES_PER_ROUND, BJ_STARTING_GOLD,
|
ACE_RANK, BJ_STARTING_GOLD, BOT_DEITY_LEVEL, FACE_RANKS, SEVEN_RANK
|
||||||
BOT_DEITY_LEVEL, FACE_RANKS, SEVEN_RANK
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class BlackjackBotAI:
|
class BlackjackBotAI:
|
||||||
"""
|
"""
|
||||||
4-Stufen-Ablaufbaum KI:
|
3-Stufen-Ablaufbaum KI (ohne Endlos-Bieten):
|
||||||
- Stufe 0..5: Abgestufte Offline-Gegner
|
1. Mitgehen? (falls Erhöhung offen) -> 2. Karte ziehen / Keine Karte -> 3. Erhöhen?
|
||||||
- Stufe 6 (BOT_DEITY_LEVEL): Entfesselte Gottheit-KI (Online-Standard, kein Kindergarten!)
|
Zieht im gesamten Tisch-Umlauf niemand eine Karte, wird automatisch aufgedeckt!
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
@ -22,7 +21,6 @@ class BlackjackBotAI:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def enforce_online_deity_bots(bot_configs: list[tuple[int, str]]) -> list[tuple[int, str]]:
|
def enforce_online_deity_bots(bot_configs: list[tuple[int, str]]) -> list[tuple[int, str]]:
|
||||||
"""Zwingt im Online-Modus ausnahmslos alle Bots auf Gottheit-Niveau (Stufe 6)."""
|
|
||||||
return [(BOT_DEITY_LEVEL, name) for _lvl, name in bot_configs]
|
return [(BOT_DEITY_LEVEL, name) for _lvl, name in bot_configs]
|
||||||
|
|
||||||
def reset_count(self):
|
def reset_count(self):
|
||||||
|
|
@ -45,58 +43,42 @@ class BlackjackBotAI:
|
||||||
else:
|
else:
|
||||||
bot.rebought = False
|
bot.rebought = False
|
||||||
|
|
||||||
# --- KNOTEN 1: Mitgehen? ---
|
# --- KNOTEN 1: Offene Erhöhung mitgehen oder austreten? ---
|
||||||
def decide_step1_mitgehen(
|
def decide_step1_mitgehen(
|
||||||
self, bot: BlackjackBotSeat, highest_bet: int, dealer_upcard: Card | None = None, remaining_cards: int = 52
|
self, bot: BlackjackBotSeat, highest_bet: int, dealer_upcard: Card | None = None, remaining_cards: int = 52
|
||||||
) -> bool:
|
) -> bool:
|
||||||
val, is_soft = HandEvaluator.evaluate(bot.hand)
|
|
||||||
to_call = max(0, highest_bet - bot.bet_in_pot)
|
to_call = max(0, highest_bet - bot.bet_in_pot)
|
||||||
lvl = bot.ai_level
|
if to_call <= 0 or bot.gold <= 0:
|
||||||
|
|
||||||
if to_call > 0 and bot.gold > 0:
|
|
||||||
if lvl == 0:
|
|
||||||
return random.random() < 0.75
|
|
||||||
|
|
||||||
# Gottheit-Stufe (6): Rechnet Pot-Odds + Dealer-Upcard + True Count knallhart gegen!
|
|
||||||
if lvl >= BOT_DEITY_LEVEL:
|
|
||||||
if val >= 19 or (not is_soft and val in (10, 11)) or is_soft:
|
|
||||||
return True
|
|
||||||
up = dealer_upcard.blackjack_value if dealer_upcard else 10
|
|
||||||
tc = self.get_true_count(remaining_cards)
|
|
||||||
# Gegen starke Dealer-Upcard (9, 10, A) mit steifer 14-16 und teurem Raise -> eiskalter Fold
|
|
||||||
if 13 <= val <= 16 and up >= 8 and to_call >= max(10, highest_bet // 4):
|
|
||||||
return False
|
|
||||||
if val == 17 and up >= 10 and to_call >= max(15, highest_bet // 2) and tc < 1.0:
|
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
if val >= 18 or val in (10, 11) or is_soft:
|
|
||||||
return True
|
|
||||||
if val <= 16 and to_call >= max(10, highest_bet // 3) and lvl >= 2:
|
|
||||||
return random.random() < 0.30
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if bot.cards_locked:
|
val, is_soft = HandEvaluator.evaluate(bot.hand)
|
||||||
# Gottheit bleibt mit 20/21 im Zug, falls noch Raisedruck aufgebaut werden kann!
|
lvl = bot.ai_level
|
||||||
if lvl >= BOT_DEITY_LEVEL and val >= 20:
|
|
||||||
|
if lvl == 0:
|
||||||
|
return random.random() < 0.75
|
||||||
|
|
||||||
|
if lvl >= BOT_DEITY_LEVEL:
|
||||||
|
if val >= 19 or (not is_soft and val in (10, 11)) or is_soft:
|
||||||
return True
|
return True
|
||||||
return False
|
up = dealer_upcard.blackjack_value if dealer_upcard else 10
|
||||||
if not is_soft and val >= 19 and 1 <= lvl < BOT_DEITY_LEVEL and random.random() < 0.65:
|
tc = self.get_true_count(remaining_cards)
|
||||||
return False
|
if 13 <= val <= 16 and up >= 8 and to_call >= max(10, highest_bet // 4):
|
||||||
|
return False
|
||||||
|
if val == 17 and up >= 10 and to_call >= max(15, highest_bet // 2) and tc < 1.0:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
|
if val >= 18 or val in (10, 11) or is_soft:
|
||||||
|
return True
|
||||||
|
if val <= 16 and to_call >= max(10, highest_bet // 3) and lvl >= 2:
|
||||||
|
return random.random() < 0.30
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# --- KNOTEN 2: Ziehen? (inkl. Double Down Option) ---
|
# --- KNOTEN 2: Karte ziehen oder keine neue Karte? ---
|
||||||
def wants_double_down(
|
def wants_double_down(
|
||||||
self,
|
self, bot: BlackjackBotSeat, dealer_upcard: Card, highest_bet: int, remaining_cards: int = 52
|
||||||
bot: BlackjackBotSeat,
|
|
||||||
dealer_upcard: Card,
|
|
||||||
highest_bet: int,
|
|
||||||
raises_in_round: int,
|
|
||||||
remaining_cards: int = 52,
|
|
||||||
) -> bool:
|
) -> bool:
|
||||||
if bot.cards_locked or len(bot.hand) != 2 or bot.ai_level < 2:
|
if bot.cards_locked or bot.doubled or len(bot.hand) != 2 or bot.ai_level < 2:
|
||||||
return False
|
|
||||||
if raises_in_round >= BJ_MAX_RAISES_PER_ROUND:
|
|
||||||
return False
|
return False
|
||||||
double_cost = max(highest_bet, bot.bet_in_pot) * 2 - bot.bet_in_pot
|
double_cost = max(highest_bet, bot.bet_in_pot) * 2 - bot.bet_in_pot
|
||||||
if bot.gold < double_cost or double_cost <= 0:
|
if bot.gold < double_cost or double_cost <= 0:
|
||||||
|
|
@ -126,22 +108,21 @@ class BlackjackBotAI:
|
||||||
def decide_step2_ziehen(
|
def decide_step2_ziehen(
|
||||||
self, bot: BlackjackBotSeat, dealer_upcard: Card, remaining_cards: int
|
self, bot: BlackjackBotSeat, dealer_upcard: Card, remaining_cards: int
|
||||||
) -> bool:
|
) -> bool:
|
||||||
if bot.cards_locked:
|
if bot.cards_locked or bot.doubled:
|
||||||
return False
|
return False
|
||||||
val, is_soft = HandEvaluator.evaluate(bot.hand)
|
val, is_soft = HandEvaluator.evaluate(bot.hand)
|
||||||
up = dealer_upcard.blackjack_value
|
up = dealer_upcard.blackjack_value
|
||||||
return self._wants_hit(bot.ai_level, bot.hand, val, is_soft, up, remaining_cards)
|
return self._wants_hit(bot.ai_level, bot.hand, val, is_soft, up, remaining_cards)
|
||||||
|
|
||||||
# --- KNOTEN 3: Erhöhen? ---
|
# --- KNOTEN 3: Einsatz erhöhen? (nur im regulären Zug, nicht im reinen Ausgleich!) ---
|
||||||
def decide_step3_erhoehen(
|
def decide_step3_erhoehen(
|
||||||
self,
|
self,
|
||||||
bot: BlackjackBotSeat,
|
bot: BlackjackBotSeat,
|
||||||
chips: tuple[int, ...],
|
chips: tuple[int, ...],
|
||||||
remaining_cards: int,
|
remaining_cards: int,
|
||||||
raises_in_round: int,
|
|
||||||
dealer_upcard: Card | None = None,
|
dealer_upcard: Card | None = None,
|
||||||
) -> int:
|
) -> int:
|
||||||
if raises_in_round >= BJ_MAX_RAISES_PER_ROUND or bot.gold < chips[0]:
|
if bot.gold < chips[0]:
|
||||||
return 0
|
return 0
|
||||||
val, is_soft = HandEvaluator.evaluate(bot.hand)
|
val, is_soft = HandEvaluator.evaluate(bot.hand)
|
||||||
lvl = bot.ai_level
|
lvl = bot.ai_level
|
||||||
|
|
@ -168,38 +149,22 @@ class BlackjackBotAI:
|
||||||
return min(bot.gold, chips[0])
|
return min(bot.gold, chips[0])
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
# --- STUFE 6: GOTTHEIT (Gnadenloser Druck bei Edge!) ---
|
# Stufe 6: Gottheit
|
||||||
up = dealer_upcard.blackjack_value if dealer_upcard else 10
|
up = dealer_upcard.blackjack_value if dealer_upcard else 10
|
||||||
affordable = [c for c in chips if c <= bot.gold]
|
affordable = [c for c in chips if c <= bot.gold]
|
||||||
if not affordable:
|
if not affordable:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if val == 21:
|
if val == 21:
|
||||||
# Mit 21 feuert Gottheit fast immer den höchsten bezahlbaren Chip rein!
|
|
||||||
return affordable[-1] if tc >= 0.0 else affordable[min(2, len(affordable) - 1)]
|
return affordable[-1] if tc >= 0.0 else affordable[min(2, len(affordable) - 1)]
|
||||||
if val == 20:
|
if val == 20:
|
||||||
if up <= 9 or tc >= 1.0:
|
return affordable[min(2, len(affordable) - 1)] if (up <= 9 or tc >= 1.0) else affordable[0]
|
||||||
return affordable[min(2, len(affordable) - 1)]
|
|
||||||
return affordable[0]
|
|
||||||
if val == 19 and (2 <= up <= 6) and not is_soft:
|
if val == 19 and (2 <= up <= 6) and not is_soft:
|
||||||
# Dealer zeigt Bust-Karte (2-6) und Gottheit hält 19 -> Gegner bluten lassen
|
|
||||||
return affordable[min(1, len(affordable) - 1)]
|
return affordable[min(1, len(affordable) - 1)]
|
||||||
if (2 <= up <= 6) and val >= 18 and tc >= 2.0:
|
if (2 <= up <= 6) and val >= 18 and tc >= 2.0:
|
||||||
return affordable[0]
|
return affordable[0]
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
# --- KNOTEN 4: Fertig? ---
|
|
||||||
def decide_step4_fertig(
|
|
||||||
self, bot: BlackjackBotSeat, dealer_upcard: Card, remaining_cards: int
|
|
||||||
) -> bool:
|
|
||||||
if bot.cards_locked:
|
|
||||||
return True
|
|
||||||
val, is_soft = HandEvaluator.evaluate(bot.hand)
|
|
||||||
if val >= 21:
|
|
||||||
return True
|
|
||||||
up = dealer_upcard.blackjack_value
|
|
||||||
return not self._wants_hit(bot.ai_level, bot.hand, val, is_soft, up, remaining_cards)
|
|
||||||
|
|
||||||
def _wants_hit(
|
def _wants_hit(
|
||||||
self, lvl: int, hand: list[Card], val: int, is_soft: bool, up: int, remaining_cards: int
|
self, lvl: int, hand: list[Card], val: int, is_soft: bool, up: int, remaining_cards: int
|
||||||
) -> bool:
|
) -> bool:
|
||||||
|
|
@ -230,7 +195,7 @@ class BlackjackBotAI:
|
||||||
return False
|
return False
|
||||||
return self._basic_strategy_hit(val, is_soft, up)
|
return self._basic_strategy_hit(val, is_soft, up)
|
||||||
|
|
||||||
# --- STUFE 6: GOTTHEIT (Volle Illustrious-18 Index-Abweichungen) ---
|
# Stufe 6: Gottheit (Illustrious-18)
|
||||||
if not is_soft:
|
if not is_soft:
|
||||||
if val == 16 and up == 10:
|
if val == 16 and up == 10:
|
||||||
return tc < 0.0
|
return tc < 0.0
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -14,10 +14,10 @@ from models.database import Database
|
||||||
from models.progression import Progression
|
from models.progression import Progression
|
||||||
from resources.code_res.game_constants import (
|
from resources.code_res.game_constants import (
|
||||||
ACCENT_GOLD, ACCENT_GOTH, BJ_BOT_CARD_SIZE, BJ_BOT_TURN_DELAY_MS,
|
ACCENT_GOLD, ACCENT_GOTH, BJ_BOT_CARD_SIZE, BJ_BOT_TURN_DELAY_MS,
|
||||||
BJ_DEALER_DELAY_MS, BJ_INITIAL_ANTE, BJ_MAX_RAISES_PER_ROUND,
|
BJ_DEALER_DELAY_MS, BJ_INITIAL_ANTE, BJ_SPLIT_CARD_SIZE,
|
||||||
BJ_SPLIT_CARD_SIZE, BJ_STARTING_GOLD, BJ_VARIANTS, BORDER_COLOR,
|
BJ_STARTING_GOLD, BJ_VARIANTS, BORDER_COLOR, CELL_BG, ERROR_FG,
|
||||||
CELL_BG, ERROR_FG, FG_COLOR, GOLD_MIN_TABLE_ENTRY, MUTED_FG,
|
FG_COLOR, GOLD_MIN_TABLE_ENTRY, MUTED_FG, PANEL_BG,
|
||||||
PANEL_BG, PLAYING_CARD_SIZE, SUBTLE_BORDER, TABLE_BG, XP_TO_GOLD_AMOUNT
|
PLAYING_CARD_SIZE, SUBTLE_BORDER, TABLE_BG, XP_TO_GOLD_AMOUNT
|
||||||
)
|
)
|
||||||
from resources.code_res.i18n import t
|
from resources.code_res.i18n import t
|
||||||
from view.widgets.image_button import ImageButton
|
from view.widgets.image_button import ImageButton
|
||||||
|
|
@ -27,7 +27,6 @@ GAME_FOLDER_ID = "blackjack"
|
||||||
STEP_MITGEHEN = "MITGEHEN"
|
STEP_MITGEHEN = "MITGEHEN"
|
||||||
STEP_ZIEHEN = "ZIEHEN"
|
STEP_ZIEHEN = "ZIEHEN"
|
||||||
STEP_ERHOEHEN = "ERHOEHEN"
|
STEP_ERHOEHEN = "ERHOEHEN"
|
||||||
STEP_FERTIG = "FERTIG"
|
|
||||||
|
|
||||||
|
|
||||||
class BlackjackTableView:
|
class BlackjackTableView:
|
||||||
|
|
@ -48,7 +47,8 @@ class BlackjackTableView:
|
||||||
self.bot_ai = BlackjackBotAI()
|
self.bot_ai = BlackjackBotAI()
|
||||||
|
|
||||||
self.active_hand_idx: int = 0
|
self.active_hand_idx: int = 0
|
||||||
self.turn_step: str = STEP_MITGEHEN
|
self.turn_step: str = STEP_ZIEHEN
|
||||||
|
self.settle_only_mode: bool = False
|
||||||
self.active_bot_idx: int = -1
|
self.active_bot_idx: int = -1
|
||||||
self.round_start_time: float = time.time()
|
self.round_start_time: float = time.time()
|
||||||
self._last_popup_payload: dict | None = None
|
self._last_popup_payload: dict | None = None
|
||||||
|
|
@ -74,7 +74,7 @@ class BlackjackTableView:
|
||||||
self._start_new_round()
|
self._start_new_round()
|
||||||
|
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
# AUTO-SAVE & RESUME (speichert auch den exakten Baum-Knoten!)
|
# AUTO-SAVE & RESUME (nur aktiv während The Devil's Deal!)
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
def _persist_state(self):
|
def _persist_state(self):
|
||||||
if not self.devils_locked:
|
if not self.devils_locked:
|
||||||
|
|
@ -84,6 +84,7 @@ class BlackjackTableView:
|
||||||
"devils_locked": self.devils_locked,
|
"devils_locked": self.devils_locked,
|
||||||
"active_hand_idx": self.active_hand_idx,
|
"active_hand_idx": self.active_hand_idx,
|
||||||
"turn_step": self.turn_step,
|
"turn_step": self.turn_step,
|
||||||
|
"settle_only_mode": self.settle_only_mode,
|
||||||
"active_bot_idx": self.active_bot_idx,
|
"active_bot_idx": self.active_bot_idx,
|
||||||
"elapsed_sec": max(0.0, time.time() - self.round_start_time),
|
"elapsed_sec": max(0.0, time.time() - self.round_start_time),
|
||||||
"running_count": self.bot_ai.running_count,
|
"running_count": self.bot_ai.running_count,
|
||||||
|
|
@ -106,7 +107,8 @@ class BlackjackTableView:
|
||||||
self.bj_account = Database.get_blackjack_account(data["bj_account_id"])
|
self.bj_account = Database.get_blackjack_account(data["bj_account_id"])
|
||||||
self.devils_locked = bool(data.get("devils_locked", False) or self.bj_account.get("devils_deal_active", 0))
|
self.devils_locked = bool(data.get("devils_locked", False) or self.bj_account.get("devils_deal_active", 0))
|
||||||
self.active_hand_idx = int(data.get("active_hand_idx", 0))
|
self.active_hand_idx = int(data.get("active_hand_idx", 0))
|
||||||
self.turn_step = data.get("turn_step", STEP_MITGEHEN)
|
self.turn_step = data.get("turn_step", STEP_ZIEHEN)
|
||||||
|
self.settle_only_mode = bool(data.get("settle_only_mode", False))
|
||||||
self.active_bot_idx = int(data.get("active_bot_idx", -1))
|
self.active_bot_idx = int(data.get("active_bot_idx", -1))
|
||||||
self.round_start_time = time.time() - float(data.get("elapsed_sec", 0.0))
|
self.round_start_time = time.time() - float(data.get("elapsed_sec", 0.0))
|
||||||
self.bot_ai.running_count = int(data.get("running_count", 0))
|
self.bot_ai.running_count = int(data.get("running_count", 0))
|
||||||
|
|
@ -126,17 +128,13 @@ class BlackjackTableView:
|
||||||
self._build_ui()
|
self._build_ui()
|
||||||
|
|
||||||
if self.engine.state == "ACTION_LOOP":
|
if self.engine.state == "ACTION_LOOP":
|
||||||
|
self._render_table(reveal_opponents=False, reveal_dealer=False)
|
||||||
if self.active_bot_idx >= 0:
|
if self.active_bot_idx >= 0:
|
||||||
self._render_table(reveal_opponents=False, reveal_dealer=False)
|
|
||||||
self._step_next_bot()
|
self._step_next_bot()
|
||||||
|
elif 0 <= self.active_hand_idx < len(self.engine.player_hands):
|
||||||
|
self._render_current_tree_step()
|
||||||
else:
|
else:
|
||||||
self._render_table(reveal_opponents=False, reveal_dealer=False)
|
self._begin_new_table_cycle()
|
||||||
if 0 <= self.active_hand_idx < len(self.engine.player_hands) and self.engine.player_hand_needs_turn(
|
|
||||||
self.engine.player_hands[self.active_hand_idx], self.bj_account["gold"]
|
|
||||||
):
|
|
||||||
self._render_current_tree_step()
|
|
||||||
else:
|
|
||||||
self._begin_next_turn_cycle()
|
|
||||||
elif self.engine.state == "DEALER_TURN":
|
elif self.engine.state == "DEALER_TURN":
|
||||||
self._render_table(reveal_opponents=True, reveal_dealer=True)
|
self._render_table(reveal_opponents=True, reveal_dealer=True)
|
||||||
self.status_lbl.configure(text=t("bj_dealer_reveals"))
|
self.status_lbl.configure(text=t("bj_dealer_reveals"))
|
||||||
|
|
@ -249,7 +247,7 @@ class BlackjackTableView:
|
||||||
self.pot_lbl.configure(text=t("bj_pot_banner", self.engine.pot, self.engine.highest_bet))
|
self.pot_lbl.configure(text=t("bj_pot_banner", self.engine.pot, self.engine.highest_bet))
|
||||||
|
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
# ROUND START (10 Gold Grundeinsatz -> Karten verteilen)
|
# ROUND START
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
def _start_new_round(self):
|
def _start_new_round(self):
|
||||||
if self._result_dialog:
|
if self._result_dialog:
|
||||||
|
|
@ -275,7 +273,7 @@ class BlackjackTableView:
|
||||||
|
|
||||||
self._last_popup_payload = None
|
self._last_popup_payload = None
|
||||||
self.active_hand_idx = 0
|
self.active_hand_idx = 0
|
||||||
self.turn_step = STEP_MITGEHEN
|
self.settle_only_mode = False
|
||||||
self.active_bot_idx = -1
|
self.active_bot_idx = -1
|
||||||
self.round_start_time = time.time()
|
self.round_start_time = time.time()
|
||||||
self.ctx.sounds.play("deal")
|
self.ctx.sounds.play("deal")
|
||||||
|
|
@ -297,7 +295,7 @@ class BlackjackTableView:
|
||||||
|
|
||||||
self._build_ui()
|
self._build_ui()
|
||||||
self._render_table(reveal_opponents=False, reveal_dealer=False)
|
self._render_table(reveal_opponents=False, reveal_dealer=False)
|
||||||
self._begin_next_turn_cycle()
|
self._begin_new_table_cycle()
|
||||||
|
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
# RENDERING TISCH & HÄNDE
|
# RENDERING TISCH & HÄNDE
|
||||||
|
|
@ -308,7 +306,7 @@ class BlackjackTableView:
|
||||||
return t("bj_state_busted")
|
return t("bj_state_busted")
|
||||||
if hand.folded:
|
if hand.folded:
|
||||||
return t("bj_state_folded")
|
return t("bj_state_folded")
|
||||||
if hand.cards_locked:
|
if hand.doubled or hand.cards_locked:
|
||||||
return t("bj_state_locked")
|
return t("bj_state_locked")
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
@ -446,38 +444,114 @@ class BlackjackTableView:
|
||||||
self._refresh_header()
|
self._refresh_header()
|
||||||
|
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
# STUFENWEISER ABLAUFBAUM FÜR DEN SPIELER
|
# TISCH-UMLAUF LOGIK (Keine Karte gezogen -> Auto-Showdown!)
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
def _begin_next_turn_cycle(self):
|
def _begin_new_table_cycle(self):
|
||||||
self.bj_account = Database.get_blackjack_account(self.bj_account["id"])
|
"""Startet einen neuen Tisch-Umlauf mit cycle_card_drawn = False."""
|
||||||
if self.engine.is_everyone_finished(self.bots, self.bj_account["gold"]):
|
if not self.engine.any_contender_alive(self.bots):
|
||||||
self._start_showdown_and_dealer()
|
self._start_showdown_and_dealer()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
self.engine.cycle_card_drawn = False
|
||||||
|
self.settle_only_mode = False
|
||||||
self.active_bot_idx = -1
|
self.active_bot_idx = -1
|
||||||
self.active_hand_idx = 0
|
self.active_hand_idx = 0
|
||||||
self._step_next_player_hand()
|
self._step_next_player_hand()
|
||||||
|
|
||||||
|
def _begin_settle_bets_pass(self):
|
||||||
|
"""
|
||||||
|
Niemand hat im Umlauf eine Karte gezogen, aber ein letzter Raise ist noch offen:
|
||||||
|
Jeder mit Rückstand darf nur noch Mitgehen oder Austreten, danach sofort Aufdecken!
|
||||||
|
"""
|
||||||
|
self.settle_only_mode = True
|
||||||
|
self.active_bot_idx = -1
|
||||||
|
self.active_hand_idx = 0
|
||||||
|
self._step_next_player_hand()
|
||||||
|
|
||||||
|
def _on_table_pass_completed(self):
|
||||||
|
"""Wird am Ende jedes Tisch-Umlaufs (Spieler + alle Bots) aufgerufen."""
|
||||||
|
if not self.engine.any_contender_alive(self.bots):
|
||||||
|
self._start_showdown_and_dealer()
|
||||||
|
return
|
||||||
|
|
||||||
|
self.bj_account = Database.get_blackjack_account(self.bj_account["id"])
|
||||||
|
wallet = self.bj_account["gold"]
|
||||||
|
|
||||||
|
if self.settle_only_mode:
|
||||||
|
# Alle offenen Einsätze beglichen -> sofort aufdecken!
|
||||||
|
self._start_showdown_and_dealer()
|
||||||
|
return
|
||||||
|
|
||||||
|
if not self.engine.cycle_card_drawn:
|
||||||
|
# KEINER hat in dieser Runde eine Karte gezogen!
|
||||||
|
if self.engine.has_unsettled_bets(self.bots, wallet):
|
||||||
|
self._begin_settle_bets_pass()
|
||||||
|
else:
|
||||||
|
self._start_showdown_and_dealer()
|
||||||
|
return
|
||||||
|
|
||||||
|
# Mindestens einer hat eine Karte gezogen -> nächster regulärer Umlauf!
|
||||||
|
self._begin_new_table_cycle()
|
||||||
|
|
||||||
|
# ---------------------------------------------------------
|
||||||
|
# SPIELER-SCHRITTE IM UMLAUF
|
||||||
|
# ---------------------------------------------------------
|
||||||
def _step_next_player_hand(self):
|
def _step_next_player_hand(self):
|
||||||
self.bj_account = Database.get_blackjack_account(self.bj_account["id"])
|
self.bj_account = Database.get_blackjack_account(self.bj_account["id"])
|
||||||
wallet = self.bj_account["gold"]
|
wallet = self.bj_account["gold"]
|
||||||
|
|
||||||
while self.active_hand_idx < len(self.engine.player_hands):
|
while self.active_hand_idx < len(self.engine.player_hands):
|
||||||
h = self.engine.player_hands[self.active_hand_idx]
|
h = self.engine.player_hands[self.active_hand_idx]
|
||||||
if self.engine.player_hand_needs_turn(h, wallet):
|
if not h.is_active_in_pot:
|
||||||
|
self.active_hand_idx += 1
|
||||||
|
continue
|
||||||
|
|
||||||
|
raw_deficit = max(0, self.engine.highest_bet - h.bet_in_pot)
|
||||||
|
to_call = min(wallet, raw_deficit)
|
||||||
|
|
||||||
|
if self.settle_only_mode:
|
||||||
|
if to_call > 0:
|
||||||
|
self.turn_step = STEP_MITGEHEN
|
||||||
|
self._persist_state()
|
||||||
|
self._render_table(reveal_opponents=False, reveal_dealer=False)
|
||||||
|
self._render_current_tree_step()
|
||||||
|
return
|
||||||
|
self.active_hand_idx += 1
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Regulärer Zug im Umlauf:
|
||||||
|
# 1. Falls ein Raise offen ist -> erst Mitgehen? fragen
|
||||||
|
if to_call > 0:
|
||||||
self.turn_step = STEP_MITGEHEN
|
self.turn_step = STEP_MITGEHEN
|
||||||
self._persist_state()
|
self._persist_state()
|
||||||
self._render_table(reveal_opponents=False, reveal_dealer=False)
|
self._render_table(reveal_opponents=False, reveal_dealer=False)
|
||||||
self._render_current_tree_step()
|
self._render_current_tree_step()
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# 2. Kein offener Raise -> direkt fragen: Karte ziehen oder Keine neue Karte?
|
||||||
|
h_val, _ = HandEvaluator.evaluate(h.cards)
|
||||||
|
if not h.cards_locked and not h.doubled and h_val < 21:
|
||||||
|
self.turn_step = STEP_ZIEHEN
|
||||||
|
self._persist_state()
|
||||||
|
self._render_table(reveal_opponents=False, reveal_dealer=False)
|
||||||
|
self._render_current_tree_step()
|
||||||
|
return
|
||||||
|
|
||||||
|
# 3. Hand steht schon bei 21 / Double Down -> darf bei verfügbarem Gold noch erhöhen
|
||||||
|
dyn_chips = self._get_current_level_chips()
|
||||||
|
if wallet >= dyn_chips[0]:
|
||||||
|
self.turn_step = STEP_ERHOEHEN
|
||||||
|
self._persist_state()
|
||||||
|
self._render_table(reveal_opponents=False, reveal_dealer=False)
|
||||||
|
self._render_current_tree_step()
|
||||||
|
return
|
||||||
|
|
||||||
self.active_hand_idx += 1
|
self.active_hand_idx += 1
|
||||||
|
|
||||||
# Alle eigenen Hände durch -> sofort der nächste Gegner dran!
|
|
||||||
self._start_bots_cycle()
|
self._start_bots_cycle()
|
||||||
|
|
||||||
def _finish_current_hand_turn(self):
|
def _finish_current_hand_turn(self):
|
||||||
self.active_hand_idx += 1
|
self.active_hand_idx += 1
|
||||||
self.turn_step = STEP_MITGEHEN
|
|
||||||
self._persist_state()
|
self._persist_state()
|
||||||
self._step_next_player_hand()
|
self._step_next_player_hand()
|
||||||
|
|
||||||
|
|
@ -494,53 +568,30 @@ class BlackjackTableView:
|
||||||
row.pack()
|
row.pack()
|
||||||
|
|
||||||
# =====================================================
|
# =====================================================
|
||||||
# KNOTEN 1: MITGEHEN?
|
# SCHRITT 1: MITGEHEN? (nur wenn ein Gegner erhöht hat!)
|
||||||
# =====================================================
|
# =====================================================
|
||||||
if self.turn_step == STEP_MITGEHEN:
|
if self.turn_step == STEP_MITGEHEN:
|
||||||
raw_deficit = max(0, self.engine.highest_bet - hand.bet_in_pot)
|
raw_deficit = max(0, self.engine.highest_bet - hand.bet_in_pot)
|
||||||
to_call = min(wallet, raw_deficit)
|
to_call = min(wallet, raw_deficit)
|
||||||
|
|
||||||
if to_call > 0:
|
self.status_lbl.configure(text=t("bj_tree_step1_call", hand_tag, to_call))
|
||||||
self.status_lbl.configure(text=t("bj_tree_step1_call", hand_tag, to_call))
|
ImageButton(
|
||||||
ImageButton(
|
row, t("bj_tree_btn_call_yes", to_call),
|
||||||
row, t("bj_tree_btn_call_yes", to_call),
|
self.ctx.assets.raw_btn, self.ctx.assets.raw_btn_active,
|
||||||
self.ctx.assets.raw_btn, self.ctx.assets.raw_btn_active,
|
lambda: self._on_step1_call_yes(to_call),
|
||||||
lambda: self._on_step1_yes(to_call),
|
sound_mgr=self.ctx.sounds, width=220, height=38, font=("Helvetica", 10, "bold")
|
||||||
sound_mgr=self.ctx.sounds, width=215, height=38, font=("Helvetica", 10, "bold")
|
).pack(side="left", padx=8)
|
||||||
).pack(side="left", padx=8)
|
|
||||||
|
|
||||||
ImageButton(
|
ImageButton(
|
||||||
row, t("bj_tree_btn_call_no_lose"),
|
row, t("bj_tree_btn_call_no_lose"),
|
||||||
self.ctx.assets.raw_sel, self.ctx.assets.raw_sel_active,
|
self.ctx.assets.raw_sel, self.ctx.assets.raw_sel_active,
|
||||||
self._on_step1_no_when_raised,
|
self._on_fold_hand,
|
||||||
sound_mgr=self.ctx.sounds, width=225, height=38, font=("Helvetica", 10, "bold")
|
sound_mgr=self.ctx.sounds, width=230, height=38, font=("Helvetica", 10, "bold")
|
||||||
).pack(side="left", padx=8)
|
).pack(side="left", padx=8)
|
||||||
else:
|
|
||||||
self.status_lbl.configure(text=t("bj_tree_step1_even", hand_tag))
|
|
||||||
ImageButton(
|
|
||||||
row, t("bj_tree_btn_play_yes"),
|
|
||||||
self.ctx.assets.raw_btn, self.ctx.assets.raw_btn_active,
|
|
||||||
lambda: self._on_step1_yes(0),
|
|
||||||
sound_mgr=self.ctx.sounds, width=235, height=38, font=("Helvetica", 10, "bold")
|
|
||||||
).pack(side="left", padx=8)
|
|
||||||
|
|
||||||
ImageButton(
|
|
||||||
row, t("bj_tree_btn_even_no_done"),
|
|
||||||
self.ctx.assets.raw_sel, self.ctx.assets.raw_sel_active,
|
|
||||||
self._on_step1_no_mark_ready,
|
|
||||||
sound_mgr=None, width=225, height=38, font=("Helvetica", 10, "bold")
|
|
||||||
).pack(side="left", padx=8)
|
|
||||||
|
|
||||||
ImageButton(
|
|
||||||
row, t("bj_fold_btn"),
|
|
||||||
self.ctx.assets.raw_sel, self.ctx.assets.raw_sel_active,
|
|
||||||
self._on_step1_no_when_raised,
|
|
||||||
sound_mgr=self.ctx.sounds, width=130, height=38, font=("Helvetica", 10, "bold")
|
|
||||||
).pack(side="left", padx=8)
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# =====================================================
|
# =====================================================
|
||||||
# KNOTEN 2: ZIEHEN? (inkl. Split / Double Down bei 2 Karten)
|
# SCHRITT 2: KARTE ZIEHEN ODER KEINE NEUE KARTE?
|
||||||
# =====================================================
|
# =====================================================
|
||||||
if self.turn_step == STEP_ZIEHEN:
|
if self.turn_step == STEP_ZIEHEN:
|
||||||
self.status_lbl.configure(text=t("bj_tree_step2_draw", hand_tag))
|
self.status_lbl.configure(text=t("bj_tree_step2_draw", hand_tag))
|
||||||
|
|
@ -550,16 +601,16 @@ class BlackjackTableView:
|
||||||
self.ctx.assets.raw_btn, self.ctx.assets.raw_btn_active,
|
self.ctx.assets.raw_btn, self.ctx.assets.raw_btn_active,
|
||||||
self._on_step2_draw_yes,
|
self._on_step2_draw_yes,
|
||||||
sound_mgr=self.ctx.sounds, width=185, height=38, font=("Helvetica", 10, "bold")
|
sound_mgr=self.ctx.sounds, width=185, height=38, font=("Helvetica", 10, "bold")
|
||||||
).pack(side="left", padx=6)
|
).pack(side="left", padx=5)
|
||||||
|
|
||||||
if self.engine.can_double_down(self.active_hand_idx, wallet, already_drew_this_turn=False):
|
if self.engine.can_double_down(self.active_hand_idx, wallet):
|
||||||
dd_cost = self.engine.get_double_down_cost(self.active_hand_idx)
|
dd_cost = self.engine.get_double_down_cost(self.active_hand_idx)
|
||||||
ImageButton(
|
ImageButton(
|
||||||
row, t("bj_double_btn", dd_cost),
|
row, t("bj_double_btn", dd_cost),
|
||||||
self.ctx.assets.raw_sel, self.ctx.assets.raw_sel_active,
|
self.ctx.assets.raw_sel, self.ctx.assets.raw_sel_active,
|
||||||
self._on_step2_double_down,
|
self._on_step2_double_down,
|
||||||
sound_mgr=self.ctx.sounds, width=175, height=38, font=("Helvetica", 10, "bold")
|
sound_mgr=self.ctx.sounds, width=170, height=38, font=("Helvetica", 10, "bold")
|
||||||
).pack(side="left", padx=6)
|
).pack(side="left", padx=5)
|
||||||
|
|
||||||
if self.engine.can_split_hand(self.active_hand_idx, wallet):
|
if self.engine.can_split_hand(self.active_hand_idx, wallet):
|
||||||
sp_cost = self.engine.highest_bet
|
sp_cost = self.engine.highest_bet
|
||||||
|
|
@ -567,19 +618,26 @@ class BlackjackTableView:
|
||||||
row, t("bj_split_btn", sp_cost),
|
row, t("bj_split_btn", sp_cost),
|
||||||
self.ctx.assets.raw_sel, self.ctx.assets.raw_sel_active,
|
self.ctx.assets.raw_sel, self.ctx.assets.raw_sel_active,
|
||||||
self._on_step2_split,
|
self._on_step2_split,
|
||||||
sound_mgr=self.ctx.sounds, width=150, height=38, font=("Helvetica", 10, "bold")
|
sound_mgr=self.ctx.sounds, width=145, height=38, font=("Helvetica", 10, "bold")
|
||||||
).pack(side="left", padx=6)
|
).pack(side="left", padx=5)
|
||||||
|
|
||||||
ImageButton(
|
ImageButton(
|
||||||
row, t("bj_tree_btn_draw_no"),
|
row, t("bj_tree_btn_draw_no"),
|
||||||
self.ctx.assets.raw_sel, self.ctx.assets.raw_sel_active,
|
self.ctx.assets.raw_sel, self.ctx.assets.raw_sel_active,
|
||||||
self._on_step2_draw_no,
|
self._on_step2_draw_no,
|
||||||
sound_mgr=self.ctx.sounds, width=180, height=38, font=("Helvetica", 10, "bold")
|
sound_mgr=None, width=180, height=38, font=("Helvetica", 10, "bold")
|
||||||
).pack(side="left", padx=6)
|
).pack(side="left", padx=5)
|
||||||
|
|
||||||
|
ImageButton(
|
||||||
|
row, t("bj_fold_btn"),
|
||||||
|
self.ctx.assets.raw_sel, self.ctx.assets.raw_sel_active,
|
||||||
|
self._on_fold_hand,
|
||||||
|
sound_mgr=self.ctx.sounds, width=120, height=38, font=("Helvetica", 10, "bold")
|
||||||
|
).pack(side="left", padx=5)
|
||||||
return
|
return
|
||||||
|
|
||||||
# =====================================================
|
# =====================================================
|
||||||
# KNOTEN 3: ERHÖHEN? (erst NACH Weiter/Ziehen sichtbar!)
|
# SCHRITT 3: ERHÖHEN?
|
||||||
# =====================================================
|
# =====================================================
|
||||||
if self.turn_step == STEP_ERHOEHEN:
|
if self.turn_step == STEP_ERHOEHEN:
|
||||||
self.status_lbl.configure(text=t("bj_tree_step3_raise", hand_tag))
|
self.status_lbl.configure(text=t("bj_tree_step3_raise", hand_tag))
|
||||||
|
|
@ -600,96 +658,56 @@ class BlackjackTableView:
|
||||||
self._on_step3_raise_no,
|
self._on_step3_raise_no,
|
||||||
sound_mgr=self.ctx.sounds, width=190, height=38, font=("Helvetica", 10, "bold")
|
sound_mgr=self.ctx.sounds, width=190, height=38, font=("Helvetica", 10, "bold")
|
||||||
).pack(side="left", padx=8)
|
).pack(side="left", padx=8)
|
||||||
return
|
|
||||||
|
|
||||||
# =====================================================
|
|
||||||
# KNOTEN 4: FERTIG?
|
|
||||||
# =====================================================
|
|
||||||
if self.turn_step == STEP_FERTIG:
|
|
||||||
self.status_lbl.configure(text=t("bj_tree_step4_done", hand_tag))
|
|
||||||
|
|
||||||
ImageButton(
|
|
||||||
row, t("bj_tree_btn_done_yes"),
|
|
||||||
self.ctx.assets.raw_btn, self.ctx.assets.raw_btn_active,
|
|
||||||
self._on_step4_done_yes,
|
|
||||||
sound_mgr=None, width=225, height=38, font=("Helvetica", 10, "bold")
|
|
||||||
).pack(side="left", padx=8)
|
|
||||||
|
|
||||||
ImageButton(
|
|
||||||
row, t("bj_tree_btn_done_no"),
|
|
||||||
self.ctx.assets.raw_sel, self.ctx.assets.raw_sel_active,
|
|
||||||
self._on_step4_done_no,
|
|
||||||
sound_mgr=self.ctx.sounds, width=230, height=38, font=("Helvetica", 10, "bold")
|
|
||||||
).pack(side="left", padx=8)
|
|
||||||
|
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
# ÜBERGÄNGE ZWISCHEN DEN BAUM-KNOTEN
|
# BUTTON-AKTIONEN SPIELER
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
def _advance_to_erhoehen_or_fertig(self):
|
def _advance_to_erhoehen_or_next(self):
|
||||||
"""Springt zu Knoten 3 (Erhöhen?), oder direkt weiter, falls kein Gold/Raise-Cap mehr frei ist."""
|
|
||||||
self.bj_account = Database.get_blackjack_account(self.bj_account["id"])
|
self.bj_account = Database.get_blackjack_account(self.bj_account["id"])
|
||||||
wallet = self.bj_account["gold"]
|
wallet = self.bj_account["gold"]
|
||||||
dyn_chips = self._get_current_level_chips()
|
dyn_chips = self._get_current_level_chips()
|
||||||
can_raise = (self.engine.raises_in_round < BJ_MAX_RAISES_PER_ROUND) and (wallet >= dyn_chips[0])
|
|
||||||
|
|
||||||
if can_raise:
|
# Solo ohne Bots und ohne gezogene Karte im Umlauf -> sofort aufdecken ohne unnötige Erhöhungs-Frage!
|
||||||
|
if not self.bots and not self.engine.cycle_card_drawn:
|
||||||
|
self._finish_current_hand_turn()
|
||||||
|
return
|
||||||
|
|
||||||
|
if wallet >= dyn_chips[0]:
|
||||||
self.turn_step = STEP_ERHOEHEN
|
self.turn_step = STEP_ERHOEHEN
|
||||||
self._persist_state()
|
self._persist_state()
|
||||||
self._render_current_tree_step()
|
self._render_current_tree_step()
|
||||||
else:
|
else:
|
||||||
self._advance_to_fertig_or_next()
|
|
||||||
|
|
||||||
def _advance_to_fertig_or_next(self):
|
|
||||||
"""Springt zu Knoten 4 (Fertig?), oder gibt direkt an den nächsten Spieler ab, falls Karten schon feststehen."""
|
|
||||||
hand = self.engine.player_hands[self.active_hand_idx]
|
|
||||||
if hand.cards_locked:
|
|
||||||
self._finish_current_hand_turn()
|
self._finish_current_hand_turn()
|
||||||
else:
|
|
||||||
self.turn_step = STEP_FERTIG
|
|
||||||
self._persist_state()
|
|
||||||
self._render_current_tree_step()
|
|
||||||
|
|
||||||
def _on_step1_yes(self, to_call: int):
|
def _on_step1_call_yes(self, to_call: int):
|
||||||
"""Knoten 1 -> Ja (Mitgehen): Zahlt ggf. Differenz ein und geht zu Knoten 2 (Ziehen?)."""
|
|
||||||
if to_call > 0:
|
if to_call > 0:
|
||||||
paid = self.engine.player_add_gold_to_pot(self.active_hand_idx, to_call)
|
paid = self.engine.player_add_gold_to_pot(self.active_hand_idx, to_call)
|
||||||
if paid > 0:
|
if paid > 0:
|
||||||
self.bj_account = Database.update_blackjack_gold(self.bj_account["id"], -paid)
|
self.bj_account = Database.update_blackjack_gold(self.bj_account["id"], -paid)
|
||||||
|
|
||||||
hand = self.engine.player_hands[self.active_hand_idx]
|
self._render_table(reveal_opponents=False, reveal_dealer=False)
|
||||||
hand.acted_once = True
|
|
||||||
h_val, _ = HandEvaluator.evaluate(hand.cards)
|
|
||||||
|
|
||||||
if not hand.cards_locked and h_val < 21:
|
if self.settle_only_mode:
|
||||||
|
self._finish_current_hand_turn()
|
||||||
|
return
|
||||||
|
|
||||||
|
hand = self.engine.player_hands[self.active_hand_idx]
|
||||||
|
h_val, _ = HandEvaluator.evaluate(hand.cards)
|
||||||
|
if not hand.cards_locked and not hand.doubled and h_val < 21:
|
||||||
self.turn_step = STEP_ZIEHEN
|
self.turn_step = STEP_ZIEHEN
|
||||||
self._persist_state()
|
self._persist_state()
|
||||||
self._render_table(reveal_opponents=False, reveal_dealer=False)
|
|
||||||
self._render_current_tree_step()
|
self._render_current_tree_step()
|
||||||
else:
|
else:
|
||||||
# Karten standen bereits fest (z.B. 21 oder vorher Fertig gemeldet) -> weiter zu Erhöhen? / Nächster!
|
self._advance_to_erhoehen_or_next()
|
||||||
self._render_table(reveal_opponents=False, reveal_dealer=False)
|
|
||||||
self._advance_to_erhoehen_or_fertig()
|
|
||||||
|
|
||||||
def _on_step1_no_mark_ready(self):
|
def _on_fold_hand(self):
|
||||||
"""Knoten 1 -> Nein (ohne offenen Raise): Spieler wird als Fertig markiert -> direkt Nächster dran!"""
|
|
||||||
self.ctx.sounds.play("stand")
|
|
||||||
hand = self.engine.player_hands[self.active_hand_idx]
|
|
||||||
hand.cards_locked = True
|
|
||||||
hand.acted_once = True
|
|
||||||
self._render_table(reveal_opponents=False, reveal_dealer=False)
|
|
||||||
self._finish_current_hand_turn()
|
|
||||||
|
|
||||||
def _on_step1_no_when_raised(self):
|
|
||||||
"""Knoten 1 -> Nein gegen Erhöhung / Austreten: Sofort Verloren (Out) -> Nächster dran!"""
|
|
||||||
hand = self.engine.player_hands[self.active_hand_idx]
|
hand = self.engine.player_hands[self.active_hand_idx]
|
||||||
hand.folded = True
|
hand.folded = True
|
||||||
hand.cards_locked = True
|
hand.cards_locked = True
|
||||||
hand.acted_once = True
|
|
||||||
self._render_table(reveal_opponents=False, reveal_dealer=False)
|
self._render_table(reveal_opponents=False, reveal_dealer=False)
|
||||||
self._finish_current_hand_turn()
|
self._finish_current_hand_turn()
|
||||||
|
|
||||||
def _on_step2_draw_yes(self):
|
def _on_step2_draw_yes(self):
|
||||||
"""Knoten 2 -> Ja (Ziehen!): Zieht Karte -> über 21 = Verloren, sonst zu Knoten 3 (Erhöhen?)."""
|
|
||||||
hand = self.engine.player_hands[self.active_hand_idx]
|
hand = self.engine.player_hands[self.active_hand_idx]
|
||||||
self.engine.player_draw_card(self.active_hand_idx)
|
self.engine.player_draw_card(self.active_hand_idx)
|
||||||
|
|
||||||
|
|
@ -699,15 +717,15 @@ class BlackjackTableView:
|
||||||
|
|
||||||
self._render_table(reveal_opponents=False, reveal_dealer=False)
|
self._render_table(reveal_opponents=False, reveal_dealer=False)
|
||||||
if hand.busted:
|
if hand.busted:
|
||||||
# Über 21 -> sofort Verloren & nächster Spieler dran!
|
|
||||||
self._finish_current_hand_turn()
|
self._finish_current_hand_turn()
|
||||||
return
|
return
|
||||||
|
|
||||||
self._advance_to_erhoehen_or_fertig()
|
self._advance_to_erhoehen_or_next()
|
||||||
|
|
||||||
def _on_step2_draw_no(self):
|
def _on_step2_draw_no(self):
|
||||||
"""Knoten 2 -> Nein (Nicht ziehen): Direkt weiter zu Knoten 3 (Erhöhen?)."""
|
"""Keine neue Karte genommen -> cycle_card_drawn bleibt unverändert!"""
|
||||||
self._advance_to_erhoehen_or_fertig()
|
self.ctx.sounds.play("stand")
|
||||||
|
self._advance_to_erhoehen_or_next()
|
||||||
|
|
||||||
def _on_step2_double_down(self):
|
def _on_step2_double_down(self):
|
||||||
paid, _card = self.engine.double_down_player_hand(self.active_hand_idx)
|
paid, _card = self.engine.double_down_player_hand(self.active_hand_idx)
|
||||||
|
|
@ -733,7 +751,6 @@ class BlackjackTableView:
|
||||||
self._render_current_tree_step()
|
self._render_current_tree_step()
|
||||||
|
|
||||||
def _on_step3_raise_yes(self, chip_amount: int):
|
def _on_step3_raise_yes(self, chip_amount: int):
|
||||||
"""Knoten 3 -> Ja (Erhöhen!): Erhöht den Pot und übergibt laut Baum direkt an Next round / nächsten Spieler!"""
|
|
||||||
paid = self.engine.player_add_gold_to_pot(self.active_hand_idx, chip_amount)
|
paid = self.engine.player_add_gold_to_pot(self.active_hand_idx, chip_amount)
|
||||||
if paid > 0:
|
if paid > 0:
|
||||||
self.bj_account = Database.update_blackjack_gold(self.bj_account["id"], -paid)
|
self.bj_account = Database.update_blackjack_gold(self.bj_account["id"], -paid)
|
||||||
|
|
@ -741,29 +758,16 @@ class BlackjackTableView:
|
||||||
self._finish_current_hand_turn()
|
self._finish_current_hand_turn()
|
||||||
|
|
||||||
def _on_step3_raise_no(self):
|
def _on_step3_raise_no(self):
|
||||||
"""Knoten 3 -> Nein: Weiter zu Knoten 4 (Fertig?)."""
|
|
||||||
self._advance_to_fertig_or_next()
|
|
||||||
|
|
||||||
def _on_step4_done_yes(self):
|
|
||||||
"""Knoten 4 -> Ja (Fertig): Karten stehen endgültig fest -> Nächster dran!"""
|
|
||||||
self.ctx.sounds.play("stand")
|
|
||||||
hand = self.engine.player_hands[self.active_hand_idx]
|
|
||||||
hand.cards_locked = True
|
|
||||||
self._render_table(reveal_opponents=False, reveal_dealer=False)
|
|
||||||
self._finish_current_hand_turn()
|
|
||||||
|
|
||||||
def _on_step4_done_no(self):
|
|
||||||
"""Knoten 4 -> Nein (Offen bleiben): Direkt der Nächste dran!"""
|
|
||||||
self._finish_current_hand_turn()
|
self._finish_current_hand_turn()
|
||||||
|
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
# BOT-ZYKLUS (durchläuft denselben 4-Knoten-Baum)
|
# BOT-ZYKLUS IM UMLAUF
|
||||||
# ---------------------------------------------------------
|
# ---------------------------------------------------------
|
||||||
def _start_bots_cycle(self):
|
def _start_bots_cycle(self):
|
||||||
for w in self.controls_frame.winfo_children():
|
for w in self.controls_frame.winfo_children():
|
||||||
w.destroy()
|
w.destroy()
|
||||||
if not self.bots or not self.engine.any_contender_alive(self.bots):
|
if not self.bots or not self.engine.any_contender_alive(self.bots):
|
||||||
self._begin_next_turn_cycle()
|
self._on_table_pass_completed()
|
||||||
return
|
return
|
||||||
self.active_bot_idx = 0
|
self.active_bot_idx = 0
|
||||||
self._persist_state()
|
self._persist_state()
|
||||||
|
|
@ -775,14 +779,17 @@ class BlackjackTableView:
|
||||||
|
|
||||||
while self.active_bot_idx < len(self.bots):
|
while self.active_bot_idx < len(self.bots):
|
||||||
bot = self.bots[self.active_bot_idx]
|
bot = self.bots[self.active_bot_idx]
|
||||||
if self.engine.bot_needs_turn(bot):
|
if bot.is_active_in_pot:
|
||||||
break
|
if not self.settle_only_mode:
|
||||||
|
break
|
||||||
|
if bot.gold > 0 and bot.bet_in_pot < self.engine.highest_bet:
|
||||||
|
break
|
||||||
self.active_bot_idx += 1
|
self.active_bot_idx += 1
|
||||||
|
|
||||||
if self.active_bot_idx >= len(self.bots):
|
if self.active_bot_idx >= len(self.bots):
|
||||||
self.active_bot_idx = -1
|
self.active_bot_idx = -1
|
||||||
self._persist_state()
|
self._persist_state()
|
||||||
self._begin_next_turn_cycle()
|
self._on_table_pass_completed()
|
||||||
return
|
return
|
||||||
|
|
||||||
bot = self.bots[self.active_bot_idx]
|
bot = self.bots[self.active_bot_idx]
|
||||||
|
|
@ -799,29 +806,31 @@ class BlackjackTableView:
|
||||||
dyn_chips = self._get_current_level_chips()
|
dyn_chips = self._get_current_level_chips()
|
||||||
raw_deficit = max(0, self.engine.highest_bet - bot.bet_in_pot)
|
raw_deficit = max(0, self.engine.highest_bet - bot.bet_in_pot)
|
||||||
to_call = min(bot.gold, raw_deficit)
|
to_call = min(bot.gold, raw_deficit)
|
||||||
bot.acted_once = True
|
|
||||||
|
|
||||||
# --- KNOTEN 1: Mitgehen? ---
|
# 1. Offene Erhöhung mitgehen oder austreten?
|
||||||
if not self.bot_ai.decide_step1_mitgehen(bot, self.engine.highest_bet):
|
if to_call > 0:
|
||||||
if to_call > 0:
|
if not self.bot_ai.decide_step1_mitgehen(
|
||||||
|
bot, self.engine.highest_bet, upcard, self.engine.deck.remaining()
|
||||||
|
):
|
||||||
bot.folded = True
|
bot.folded = True
|
||||||
bot.cards_locked = True
|
bot.cards_locked = True
|
||||||
bot.status_text = t("bj_bot_action_fold")
|
bot.status_text = t("bj_bot_action_fold")
|
||||||
else:
|
self._finish_bot_step()
|
||||||
bot.cards_locked = True
|
return
|
||||||
bot.status_text = t("bj_bot_action_ready", len(bot.hand))
|
|
||||||
self._finish_bot_step()
|
|
||||||
return
|
|
||||||
|
|
||||||
# Bot geht mit!
|
|
||||||
if to_call > 0:
|
|
||||||
self.ctx.sounds.play("click")
|
self.ctx.sounds.play("click")
|
||||||
self.engine.bot_add_gold_to_pot(bot, to_call)
|
self.engine.bot_add_gold_to_pot(bot, to_call)
|
||||||
|
|
||||||
# --- KNOTEN 2: Ziehen? ---
|
# Im Settle-Modus nach kartenlosem Umlauf nur noch begleichen -> fertig!
|
||||||
|
if self.settle_only_mode:
|
||||||
|
bot.status_text = t("bj_bot_action_call", to_call)
|
||||||
|
self._finish_bot_step()
|
||||||
|
return
|
||||||
|
|
||||||
|
# 2. Karte ziehen oder keine neue Karte?
|
||||||
drew_card = False
|
drew_card = False
|
||||||
if not bot.cards_locked:
|
if not bot.cards_locked and not bot.doubled:
|
||||||
if self.bot_ai.wants_double_down(bot, upcard, self.engine.highest_bet, self.engine.raises_in_round):
|
if self.bot_ai.wants_double_down(bot, upcard, self.engine.highest_bet, self.engine.deck.remaining()):
|
||||||
dd_cost = max(self.engine.highest_bet, bot.bet_in_pot) * 2 - bot.bet_in_pot
|
dd_cost = max(self.engine.highest_bet, bot.bet_in_pot) * 2 - bot.bet_in_pot
|
||||||
paid = self.engine.bot_add_gold_to_pot(bot, dd_cost)
|
paid = self.engine.bot_add_gold_to_pot(bot, dd_cost)
|
||||||
self.ctx.sounds.play("click")
|
self.ctx.sounds.play("click")
|
||||||
|
|
@ -850,36 +859,26 @@ class BlackjackTableView:
|
||||||
self._trigger_instant_777_win(winner_is_player=False, winning_bot=bot)
|
self._trigger_instant_777_win(winner_is_player=False, winning_bot=bot)
|
||||||
return
|
return
|
||||||
|
|
||||||
# Über 21? -> Verloren!
|
|
||||||
if bot.busted:
|
if bot.busted:
|
||||||
b_val, _ = HandEvaluator.evaluate(bot.hand)
|
b_val, _ = HandEvaluator.evaluate(bot.hand)
|
||||||
bot.status_text = t("bj_bot_action_bust", b_val)
|
bot.status_text = t("bj_bot_action_bust", b_val)
|
||||||
self._finish_bot_step()
|
self._finish_bot_step()
|
||||||
return
|
return
|
||||||
|
|
||||||
# --- KNOTEN 3: Erhöhen? ---
|
# 3. Optional erhöhen (nur wenn im aktuellen Umlauf schon eine Karte gezogen wurde oder man Druck macht)
|
||||||
raise_amt = self.bot_ai.decide_step3_erhoehen(
|
raise_amt = self.bot_ai.decide_step3_erhoehen(
|
||||||
bot, dyn_chips, self.engine.deck.remaining(), self.engine.raises_in_round
|
bot, dyn_chips, self.engine.deck.remaining(), upcard
|
||||||
)
|
)
|
||||||
if raise_amt > 0:
|
if raise_amt > 0:
|
||||||
self.ctx.sounds.play("click")
|
self.ctx.sounds.play("click")
|
||||||
self.engine.bot_add_gold_to_pot(bot, raise_amt)
|
self.engine.bot_add_gold_to_pot(bot, raise_amt)
|
||||||
if self.bot_ai.decide_step4_fertig(bot, upcard, self.engine.deck.remaining()):
|
|
||||||
bot.cards_locked = True
|
|
||||||
bot.status_text = t("bj_bot_action_bet", raise_amt)
|
bot.status_text = t("bj_bot_action_bet", raise_amt)
|
||||||
self._finish_bot_step()
|
elif drew_card:
|
||||||
return
|
bot.status_text = t("bj_bot_action_hit", len(bot.hand))
|
||||||
|
elif to_call > 0:
|
||||||
# --- KNOTEN 4: Fertig? ---
|
bot.status_text = t("bj_bot_action_call", to_call)
|
||||||
if self.bot_ai.decide_step4_fertig(bot, upcard, self.engine.deck.remaining()):
|
|
||||||
bot.cards_locked = True
|
|
||||||
bot.status_text = (
|
|
||||||
t("bj_bot_action_call", to_call) if to_call > 0 else t("bj_bot_action_ready", len(bot.hand))
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
bot.status_text = (
|
bot.status_text = t("bj_bot_action_ready", len(bot.hand))
|
||||||
t("bj_bot_action_hit", len(bot.hand)) if drew_card else t("bj_bot_action_check", len(bot.hand))
|
|
||||||
)
|
|
||||||
|
|
||||||
self._finish_bot_step()
|
self._finish_bot_step()
|
||||||
|
|
||||||
|
|
|
||||||
BIN
user_data.db
BIN
user_data.db
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue