Run code after game finishes


I’m trying to rig my game to log data after each turn. The only problem is that after sending the commands for the last move the games is killed. I can’t even seem to log anything in the caught EOFError exception in Anyone got any ideas?

At the moment, I’m leaning toward just doing all the halite collected/cost maths myself so I don’t need the same to finish, but that just complicates things more…


Detect last turn and flush log. Something like:

game.turn_number == const.MAX_TURNS (or MAX_TURNS - 1)


Won’t this trigger when I’m playing my last move? Not when I’ve finished playing it?


Yes. After you finished playing your bot got SIGTERM (or other terminate signal, doesn’t tested it) so you can not do anything.


Shame there isn’t some kind of cooldown period in the local client to allow for logging of final game state!



Your cooldown period is up to 2s in the last turn before sending the final move. :innocent: