mirror of
https://github.com/RichieCahill/dotfiles.git
synced 2026-04-17 13:08:19 -04:00
fixed some coderabit issues
This commit is contained in:
@@ -78,6 +78,11 @@ class RandomBot(Strategy):
|
|||||||
return auto_discard_tokens(player, excess)
|
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):
|
class PersonalizedBot(Strategy):
|
||||||
"""PersonalizedBot."""
|
"""PersonalizedBot."""
|
||||||
|
|
||||||
@@ -87,10 +92,6 @@ class PersonalizedBot(Strategy):
|
|||||||
"""Initialize the bot."""
|
"""Initialize the bot."""
|
||||||
super().__init__(name=name)
|
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:
|
def choose_action(self, game: GameState, player: PlayerState) -> Action | None:
|
||||||
"""Choose an action for the current player."""
|
"""Choose an action for the current player."""
|
||||||
for tier in (1, 2, 3):
|
for tier in (1, 2, 3):
|
||||||
@@ -113,11 +114,6 @@ class PersonalizedBot(Strategy):
|
|||||||
return auto_discard_tokens(player, excess)
|
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):
|
class PersonalizedBot2(Strategy):
|
||||||
"""PersonalizedBot2."""
|
"""PersonalizedBot2."""
|
||||||
|
|
||||||
@@ -180,7 +176,7 @@ def buy_card(game: GameState, player: PlayerState) -> Action | None:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def take_toekns(game: GameState) -> Action | None:
|
def take_tokens(game: GameState) -> Action | None:
|
||||||
"""Take tokens."""
|
"""Take tokens."""
|
||||||
colors_for_diff = [color for color in BASE_COLORS if game.bank[color] > 0]
|
colors_for_diff = [color for color in BASE_COLORS if game.bank[color] > 0]
|
||||||
if len(colors_for_diff) >= 3:
|
if len(colors_for_diff) >= 3:
|
||||||
|
|||||||
Reference in New Issue
Block a user