improve endgame table output

This commit is contained in:
Maximilian Keßler 2024-01-14 13:11:02 +01:00
parent e4635461c1
commit 96c6fc0df2
Signed by: max
GPG key ID: BCC5A619923C0BA5
3 changed files with 21 additions and 5 deletions

2
deps/py-hanabi vendored

@ -1 +1 @@
Subproject commit 3ac51d574e65aff9b3420fdebd467d7b98ea1d28 Subproject commit 51e09cd94393de64e07191d6ca544139417acb3b

View file

@ -754,7 +754,13 @@ class EndgameActionRow:
def convert_endgame_action(endgame_action: endgames.EndgameAction) -> EndgameActionRow: def convert_endgame_action(endgame_action: endgames.EndgameAction) -> EndgameActionRow:
description = "{} {}".format(endgames.print_action_type(endgame_action.action_type), endgame_action.card) action_str = endgames.print_action_type(endgame_action.action_type)
target_str: str
if action_str != "Clue":
target_str = " {}".format(endgame_action.card)
else:
target_str = ""
description = action_str + target_str
return EndgameActionRow(description, endgame_action.enumerator, endgame_action.denominator) return EndgameActionRow(description, endgame_action.enumerator, endgame_action.denominator)

View file

@ -23,9 +23,19 @@
<div class="tab-pane fade show active" id="overview"> <div class="tab-pane fade show active" id="overview">
<div class="container my-5"> <div class="container my-5">
<h3> <h3>
Endgame Statistics for game {{game_id}} Statistics for game {{game_id}}
</h3> </h3>
<a href="https://hanab.live/replay/{{game_id}}">Replay Link</a> <ul>
<li>
Replay: <a href="https://hanab.live/replay/{{game_id}}">https://hanab.live/replay/{{game_id}}</a>
</li>
<li>
Shared Replay: <a href="https://hanab.live/shared-replay/{{game_id}}">https://hanab.live/shared-replay/{{game_id}}</a>
</li>
</ul>
<h4>
Endgame Analysis table
</h4>
<table class="endgame-table"> <table class="endgame-table">
<tr> <tr>
<th>Turn</th> <th>Turn</th>
@ -35,7 +45,7 @@
</tr> </tr>
{% for (turn, best_action, other_actions) in data %} {% for (turn, best_action, other_actions) in data %}
<tr> <tr>
<td rowspan="{{ other_actions|length + 1 }}">{{ turn }}</td> <td rowspan="{{ other_actions|length + 1 }}"><a href="https://hanab.live/replay/{{game_id}}#{{turn}}">{{ turn }}</td>
<td>{{ best_action.description }}</td> <td>{{ best_action.description }}</td>
<td>{{ best_action.enumerator }}/{{ best_action.denominator }}</td> <td>{{ best_action.enumerator }}/{{ best_action.denominator }}</td>
<td>{{ best_action.win_rate }}%</td> <td>{{ best_action.win_rate }}%</td>