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 raw_output = time_err.stdout
output = raw_output.decode('utf-8') 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) # Now, parse all results that we obtained (unclear how many depending on whether we ran into the timeout)
probabilities = {} probabilities = {}
# Check if the game was just over before reaching the specified draw pile size # 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): 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): 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)} return {str(size): 0 for size in range(1, max_draw_pile_size + 1)}
else: else:
probabilities[str(m.group(1))] = 0 probabilities[str(m.group(1))] = 0
@ -51,8 +48,6 @@ def full_analyze_game(game_id: int):
raw_output = time_err.stdout raw_output = time_err.stdout
output = raw_output.decode('utf-8') output = raw_output.decode('utf-8')
print(output)
probabilities = {} probabilities = {}
zero_dict = { zero_dict = {
(('+' if clue_modifier >= 0 else '') + str(clue_modifier)): 0 for clue_modifier in range(-8, 9) (('+' 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: def lookup_val(endgame_dict, clue_modifier) -> str:
print('looking up val {} in {}'.format(clue_modifier, endgame_dict))
if clue_modifier > 0: if clue_modifier > 0:
for lookup in range(clue_modifier, 0, -1): for lookup in range(clue_modifier, 0, -1):
val = endgame_dict.get('+' + str(lookup), None) val = endgame_dict.get('+' + str(lookup), None)
@ -199,7 +198,6 @@ if __name__ == "__main__":
writer.writerow(endgame) writer.writerow(endgame)
all_endgames = full_analyze_endgames(games) all_endgames = full_analyze_endgames(games)
print(all_endgames.keys())
fieldnames = ['Game ID'] + [str(i) for i in range(1, 11)] fieldnames = ['Game ID'] + [str(i) for i in range(1, 11)]
for clue_modifier in range(-2, 3): for clue_modifier in range(-2, 3):
filename = 'endgames{}.csv'.format(clue_modifier) filename = 'endgames{}.csv'.format(clue_modifier)
@ -212,11 +210,10 @@ if __name__ == "__main__":
row = {'Game ID': game_id} row = {'Game ID': game_id}
for deck_size in range(1, 11): for deck_size in range(1, 11):
val = lookup_val(endgame.get(str(deck_size), {}), clue_modifier) val = lookup_val(endgame.get(str(deck_size), {}), clue_modifier)
print('looked up val {}'.format(val))
if val is not None: if val is not None:
row[str(deck_size)] = val row[str(deck_size)] = val
else: 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) writer.writerow(row)
print('processed file {}'.format(filename)) print('processed file {}'.format(filename))