Halite Home

How to invoke function after game is over


#1

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.

Help?


#2

It is. Your bot is sent a SIGKILL signal.


#3

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.


#4

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


#5

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.