ulope / planetwars-python-kit

An python interface to the second Google AI-Contest (PlanetWars) at http://ai-contest.com
16 stars 12 forks source link

Bot doesn't stop after stdin is closed. #1

Open gordon-quad opened 14 years ago

gordon-quad commented 14 years ago

Bot still running after controlling program closes stdin.

ulope commented 14 years ago

How are you noticing that? The game engine should kill the bots after a match is finished.

In other words what happens that should not happen or vice versa?

gordon-quad commented 14 years ago

I think this is due that I running it from shell script. bot.sh containg following: python MyBot.py --log mybot.log

command: LANG=en_US java -jar tools/PlayGame.jar maps/map7.txt 2000 20 log.txt "./bot.sh" "java -jar example_bots/BullyBot.jar" >/dev/null ; sleep 1 ; ps ax|grep MyBot |grep -v grep Turn 1 [...] Turn 21 Player 1 Wins! 24025 pts/4 R 0:01 python MyBot.py --log mybot.log

gordon-quad commented 14 years ago

Yep. When I run PlayGame with "python MyBot.py" it was killed. But I think it is a bit abnormally to continue running when parent process is killed.

ulope commented 14 years ago

What happens if you run one of the example bots through a script. Does it terminate or also continue running?

gordon-quad commented 14 years ago

$ rm mybot.log ; LANG=en_US java -jar tools/PlayGame.jar maps/map7.txt 2000 20 log.txt "python MyBot.py --log mybot.log" "./bot2.sh" >/dev/null ; sleep 1 ; ps ax|grep BullyBot | grep -v grep Turn 1 [...] Turn 21 Player 1 Wins!

Java bot was terminated well. bot2.sh: java -jar example_bots/BullyBot.jar

ulope commented 14 years ago

Hm I'm not really sure what I can do here. AFAIK I'm not doing anything in my code that would prevent it from being killed...