Halite Home

How to invoke function after game is over


I've written a bot in Python (haven't posted it publicly yet). I want to call a method to log some statistics. My bot is written as a Python class, however del and exit both aren't being called. I've also just called a method manually after my run method (which has the sendFrame loop in it), but that doesn't happen. It's as if once the game is over the whole script is killed abruptly.



It is. Your bot is sent a SIGKILL signal.


Cool, thanks Michael! That's what I figured, but wasn't sure. Maybe tonight I'll work on catching the sigkill event. If I get working, I'll post the code here.


Looks like SIGKILL cannot be caught. Any chance could send a SIGTERM?


I am not sure if this is python specific, but Java processes can catch SIGKILL and that what I actually have to do to write to my log file.
It seems strange that a python program would not be able to do so.