From 20f4cfc67ed1719fb73f1aba070958c8cefc62cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Sat, 13 Jan 2024 14:35:24 +0100 Subject: [PATCH] convenience function --- src/endgames.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/endgames.py b/src/endgames.py index b45eeaa..4407b93 100644 --- a/src/endgames.py +++ b/src/endgames.py @@ -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