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