Skip to content

Commit b5f95bd

Browse files
committed
Modifies logic used to determine winner to reflect the fact that because a game can end with all the buildings destroyed, you cannot determine the winner by eliminating the recorder in matches where its 1vX unless all opposing players are observed leaving
1 parent c595911 commit b5f95bd

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

sc2reader/replay.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,9 @@ def _process_results(self):
175175
#If, at the end, only one team remains then that team has won
176176
if len(remaining) == 1:
177177
self.results[remaining.pop()] = "Won"
178-
elif self.recorder:
178+
179+
#Because you can also end the game by destroying all buildings, FFA can't be known
180+
elif self.type != 'FFA':
179181
#The other results are unknown except in the (common) case that the
180182
#recorder is the last one on his team to leave. In this case, the
181183
#result for his team can be known
@@ -191,11 +193,17 @@ def _process_results(self):
191193
#If, at the end, only one team remains then that team has won
192194
if len(remaining) == 1:
193195
self.results[remaining.pop()] = "Won"
194-
196+
self.winner_known = True
197+
198+
#If the winner can't be known mark all remaining player.result as unknown
199+
else:
200+
for team in remaining:
201+
self.results[team] = "Unknown"
202+
203+
#Knowing the team results, map results to the players as well
195204
for player in self.players:
196205
player.result = self.results[player.team]
197-
if player.result == "Won":
198-
self.winner_known = True
206+
199207

200208
if __name__ == '__main__':
201209
from pprint import PrettyPrinter

0 commit comments

Comments
 (0)