From 3be1b8aa8f84b82b987e030e4946de960f3f0621 Mon Sep 17 00:00:00 2001 From: Richie Cahill Date: Sat, 29 Nov 2025 13:31:20 -0500 Subject: [PATCH] fixed some coderabit issues --- python/splendor/bot.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/python/splendor/bot.py b/python/splendor/bot.py index 7c86190..ee438be 100644 --- a/python/splendor/bot.py +++ b/python/splendor/bot.py @@ -78,6 +78,11 @@ class RandomBot(Strategy): return auto_discard_tokens(player, excess) +def check_cards_in_tier(row: list[Card], player: PlayerState) -> list[int]: + """Check if player can afford card, using discounts + gold.""" + return [index for index, card in enumerate(row) if can_bot_afford(player, card)] + + class PersonalizedBot(Strategy): """PersonalizedBot.""" @@ -87,10 +92,6 @@ class PersonalizedBot(Strategy): """Initialize the bot.""" super().__init__(name=name) - def check_cards_in_tier(self, row: list[Card], player: PlayerState) -> bool: - """Check if player can afford card, using discounts + gold.""" - return [index for index, card in enumerate(row) if can_bot_afford(player, card)] - def choose_action(self, game: GameState, player: PlayerState) -> Action | None: """Choose an action for the current player.""" for tier in (1, 2, 3): @@ -113,11 +114,6 @@ class PersonalizedBot(Strategy): return auto_discard_tokens(player, excess) -def check_cards_in_tier(row: list[Card], player: PlayerState) -> bool: - """Check if player can afford card, using discounts + gold.""" - return [index for index, card in enumerate(row) if can_bot_afford(player, card)] - - class PersonalizedBot2(Strategy): """PersonalizedBot2.""" @@ -180,7 +176,7 @@ def buy_card(game: GameState, player: PlayerState) -> Action | None: return None -def take_toekns(game: GameState) -> Action | None: +def take_tokens(game: GameState) -> Action | None: """Take tokens.""" colors_for_diff = [color for color in BASE_COLORS if game.bank[color] > 0] if len(colors_for_diff) >= 3: