I’m trying to make an ai that gets its reward from the end of the game. So I have been trying to figure out if there is something I can run at the end of the game to see if I lost or won?
The hlt_client has a compare_bots.py file that you can use to see how to determine the winner. If you run the halite client with —results-as-json
From the game result string, extract the winner’s id.
:param game_result: The result of running a game on the Halite binary
for player_id, stats in results[“stats”].items():
if stats[“rank”] == 1:
I also store the bot cmd so I can link the id to a cmd then switch what id the bots are and still track wins by cmd used.
If you mean inside the bot itself, the bot is not sent the final game state (after the last moves) and so is never given the final score.
You could probably get a close enough result by taking the scores of all the players on the second last frame.