Add 'loss' to game outcomes in case nothing else has been found

This commit is contained in:
Maximilian Keßler 2023-12-23 02:48:35 +01:00
parent 38cd891b5b
commit d238c3b67e
Signed by: max
GPG key ID: BCC5A619923C0BA5

View file

@ -19,6 +19,7 @@ class GameOutcome(aenum.Enum):
bottom_deck = 4, 'Bottom Deck' bottom_deck = 4, 'Bottom Deck'
vote_to_kill = 5, 'Vote to Kill' vote_to_kill = 5, 'Vote to Kill'
out_of_pace = 6, 'Out of Pace' out_of_pace = 6, 'Out of Pace'
loss = 7, 'Loss'
class GameAnalysisResult: class GameAnalysisResult:
@ -71,6 +72,8 @@ def analyze_replay(instance: hanab_game.HanabiInstance, actions: List[hanab_game
outcomes.add(GameOutcome.vote_to_kill) outcomes.add(GameOutcome.vote_to_kill)
if game.score == 5 * instance.num_suits: if game.score == 5 * instance.num_suits:
outcomes.add(GameOutcome.win) outcomes.add(GameOutcome.win)
if not outcomes:
outcomes.add(GameOutcome.loss)
return GameAnalysisResult(outcomes, bdrs, lost_crits) return GameAnalysisResult(outcomes, bdrs, lost_crits)