convenience function

This commit is contained in:
Maximilian Keßler 2024-01-13 14:35:24 +01:00
parent bfe83d4f43
commit 20f4cfc67e
Signed by: max
GPG key ID: BCC5A619923C0BA5

View file

@ -27,7 +27,13 @@ class EndgameAction:
denominator: int
def analyze_game_from_db(game_id: int, refresh_cache=False):
def analyze_and_store_game(game_id: int) -> int:
actions, return_code = analyze_game_from_db(game_id)
store_endgame_actions(game_id, actions)
return return_code
def analyze_game_from_db(game_id: int, refresh_cache=False) -> Tuple[List[EndgameAction], int]:
# In order to pass the game replay to the endgame analyzer (a C++ program), we use the hanab.live json format.
# In order to avoid to need to use the /export endpoint of hanab.live, we create the json replay ourselves from
# the information stored in the database. Note that this is partially lossy, since the GameState class we use here