Open apinkin opened 14 years ago
It may be possible that you are logging so much that in some rounds your bot is taking longer than 0.95 seconds to complete the turn and the automatic timeout protection is "kicking in". Check your log for "Bot failed to catch TimeIsUp exception" warnings. Also see the doc string of the Game class for more information on timeouts.
I seem to be having an similar issue, only thing is, I loose if logging is turned off.
./playgame python_starter_package/maps/map$2.txt 1000 200 log.txt "java -jar python_starter_package/example_bots/$1.jar" "python planetwars-python-kit/MyBot.py " ... Turn 201 ... Player 1 Wins!
./playgame python_starter_package/maps/map$2.txt 1000 200 log.txt "java -jar python_starter_package/example_bots/$1.jar" "python planetwars-python-kit/MyBot.py -l foo.log --level DEBUG" ... Turn 97 ... Player 2 Wins!
I only have log.debug statement in my bot, so I thought, maybe I will try with INFO? ./playgame python_starter_package/maps/map$2.txt 1000 200 log.txt "java -jar python_starter_package/example_bots/$1.jar" "python planetwars-python-kit/MyBot.py -l foo.log --level INFO" ... Turn 97 ... Player 2 Wins!
And with ERROR ./playgame python_starter_package/maps/map$2.txt 1000 200 log.txt "java -jar python_starter_package/example_bots/$1.jar" "python planetwars-python-kit/MyBot.py -l foo.log --level ERROR" ... Turn 185 ... Player 2 Wins!
I will try to do some debugging later today.
It turned out my bot was not fully deterministic since some of the sorts could return planets in different order. I had to modify the sorts to make sure they are always fully deterministic.
for instance,
my_nearest_planets = sorted(self.universe.my_planets, key=lambda p : p.distance(source_planet) + p.id/1000000.0)
tedwards, see if this fixes your problem as well.
Hi Ulope, seeing some weird behavior which is reproducible consistently on two of my systems. Depending on whether logging is on (using --log option) I get different number of turns. I'm really puzzled what can be causing this. I don't have any random factor in my my bot's code, and sorted() in python is supposed to do stable sort.
java -jar tools/PlayGame.jar maps/map1.txt 1000 200 log.txt "python MyBot.py" "python MyBot.py" ... Turn 143 Player 2 Wins!
java -jar tools/PlayGame.jar maps/map1.txt 1000 200 log.txt "python MyBot.py" "python MyBot.py --log 2.log"
... Turn 132 Player 2 Wins!
java -jar tools/PlayGame.jar maps/map1.txt 1000 200 log.txt "python MyBot.py --log 1.log" "python MyBot.py --log 2.log" ... Turn 140 Player 2 Wins!
Any ideas? Thanks in advance.