clean up prints

This commit is contained in:
Maximilian Keßler 2023-11-12 00:20:46 +01:00
parent 323c09d3c5
commit 49142ba4f5
Signed by: max
GPG key ID: BCC5A619923C0BA5
2 changed files with 1 additions and 9 deletions

View file

@ -23,15 +23,12 @@ def analyze_game(game_id: int):
raw_output = time_err.stdout
output = raw_output.decode('utf-8')
print(output)
# Now, parse all results that we obtained (unclear how many depending on whether we ran into the timeout)
probabilities = {}
# Check if the game was just over before reaching the specified draw pile size
for m in re.finditer(r'The given draw pile size \(([0-9]+)\) cannot be obtained with the specified replay.', output):
if m.group(1) == str(max_draw_pile_size):
print('detected empty output')
return {str(size): 0 for size in range(1, max_draw_pile_size + 1)}
else:
probabilities[str(m.group(1))] = 0
@ -51,8 +48,6 @@ def full_analyze_game(game_id: int):
raw_output = time_err.stdout
output = raw_output.decode('utf-8')
print(output)
probabilities = {}
zero_dict = {
(('+' if clue_modifier >= 0 else '') + str(clue_modifier)): 0 for clue_modifier in range(-8, 9)

View file

@ -134,7 +134,6 @@ def sort_players_by_num_games(games_dict):
def lookup_val(endgame_dict, clue_modifier) -> str:
print('looking up val {} in {}'.format(clue_modifier, endgame_dict))
if clue_modifier > 0:
for lookup in range(clue_modifier, 0, -1):
val = endgame_dict.get('+' + str(lookup), None)
@ -199,7 +198,6 @@ if __name__ == "__main__":
writer.writerow(endgame)
all_endgames = full_analyze_endgames(games)
print(all_endgames.keys())
fieldnames = ['Game ID'] + [str(i) for i in range(1, 11)]
for clue_modifier in range(-2, 3):
filename = 'endgames{}.csv'.format(clue_modifier)
@ -212,11 +210,10 @@ if __name__ == "__main__":
row = {'Game ID': game_id}
for deck_size in range(1, 11):
val = lookup_val(endgame.get(str(deck_size), {}), clue_modifier)
print('looked up val {}'.format(val))
if val is not None:
row[str(deck_size)] = val
else:
print("No results found for game {} and deck size {}: {}".format(game_id, deck_size, endgame.get(str(deck_size))))
print("WARN: No results found for game {} and deck size {}: {}".format(game_id, deck_size, endgame.get(str(deck_size))))
writer.writerow(row)
print('processed file {}'.format(filename))