Fix input paths. Include losses in table.

This commit is contained in:
Maximilian Keßler 2023-11-21 16:20:56 +01:00
parent b832a3aa5c
commit 9e4ecf59c7
Signed by: max
GPG Key ID: BCC5A619923C0BA5
2 changed files with 5 additions and 3 deletions

View File

@ -78,7 +78,7 @@ def full_analyze_game_cached(game_id: int, strategy: Optional[str] = None):
cached = DATA.get(key, {}).get(str(game_id), None)
if cached is not None:
return cached
result = full_analyze_game(str(GAMES_PATH / str(game_id)) + '-{}'.format(strategy) if strategy is not None else '')
result = full_analyze_game(str(GAMES_PATH / str(game_id)) + ('-{}'.format(strategy) if strategy is not None else ''))
if key not in DATA.keys():
DATA[key] = {}
DATA[key][game_id] = result
@ -93,7 +93,7 @@ def analyze_game_cached(game_id: int, strategy: Optional[str] = None):
cached = DATA.get(key, {}).get(str(game_id), None)
if cached is not None:
return cached
result = analyze_game(str(GAMES_PATH / str(game_id)) + '-{}'.format(strategy) if strategy is not None else '')
result = analyze_game(str(GAMES_PATH / str(game_id)) + ('-{}'.format(strategy) if strategy is not None else ''))
if key not in DATA.keys():
DATA[key] = {}
DATA[key][game_id] = result

View File

@ -259,6 +259,7 @@ def make_team_table(games, analysis):
'Games': 0,
'BDR': 0,
'Win': 0,
'Loss': 0,
'Discard crit': 0,
'Bomb crit': 0,
'Strikeout': 0,
@ -271,12 +272,13 @@ def make_team_table(games, analysis):
if entry.won:
stats[num_p][key]['Win'] += 1
else:
stats[num_p][key]['Loss'] += 1
stats[num_p][key][termination] += 1
for num_p in range(3, 6):
filename = Path('out/teams_{}.csv'.format(num_p))
with open(filename, 'w') as f:
writer = csv.DictWriter(f, fieldnames=['Team', 'Games', 'Win', 'BDR', 'Discard crit', 'Bomb crit', 'Strikeout', 'VTK', 'Lost Endgame'])
writer = csv.DictWriter(f, fieldnames=['Team', 'Games', 'Win', 'Loss', 'BDR', 'Discard crit', 'Bomb crit', 'Strikeout', 'VTK', 'Lost Endgame'])
writer.writeheader()
for team, row in sorted(stats[num_p].items(), key=lambda item: -item[1]['Games']):
row['Team'] = team