fix: handling bdrs from ones
This commit is contained in:
parent
ea723bdaff
commit
1d07cf67b1
1 changed files with 12 additions and 3 deletions
15
src/stats.py
15
src/stats.py
|
@ -53,9 +53,18 @@ 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:
|
||||
bdrs.append((card, game.draw_pile_size))
|
||||
if card == game.deck[-1]:
|
||||
outcomes.add(GameOutcome.bottom_deck)
|
||||
# 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)
|
||||
|
||||
for action in actions:
|
||||
if action.type == hanab_game.ActionType.Discard:
|
||||
|
|
Loading…
Reference in a new issue