fix: handling bdrs from ones
This commit is contained in:
parent
ea723bdaff
commit
1d07cf67b1
1 changed files with 12 additions and 3 deletions
|
@ -53,6 +53,15 @@ def analyze_replay(instance: hanab_game.HanabiInstance, actions: List[hanab_game
|
|||
outcomes.add(GameOutcome.bottom_deck)
|
||||
else:
|
||||
if game.deck[game.progress:].count(card) == 1:
|
||||
# Only one copy of this 1 remaining in the draw pile.
|
||||
# See if it is in somebody's hand
|
||||
num_copies_in_hands = 0
|
||||
for hand in game.hands:
|
||||
num_copies_in_hands += hand.count(card)
|
||||
# Recall we evaluate the discard *before* the card is removed from the hand,
|
||||
# so there is at least one present.
|
||||
assert num_copies_in_hands > 0
|
||||
if num_copies_in_hands == 1:
|
||||
bdrs.append((card, game.draw_pile_size))
|
||||
if card == game.deck[-1]:
|
||||
outcomes.add(GameOutcome.bottom_deck)
|
||||
|
|
Loading…
Reference in a new issue