Bug: entire bot is winning and then suddenly dies


#1

this is my first bug so im not sure if this is well understood

look at how the winner drops to 0 at the last turn

all the ships just get wiped off the map

whats going on?


#2

slightly different bot but look at this: https://halite.io/play/?game_id=8262476&replay_class=0&replay_name=replay-20180117-231304%2B0000--4163674498-312-208-1516230698


#3

It's likely a timeout - your bot has 2 seconds to make a move; if it doesn't it's eliminated.


#4

thank you. im new to this game. sorry for nooby question.


#5

But why does a bot timeout, even with a timer inside?

import time
...
start_of_round = time.time()
for ship in game_map.get_me().all_ships():
   ...
   current_time = time.time()
   have_time = current_time - start_of_round < 1.8
   if not have_time:
       break
game.send_command_queue(command_queue)

Yes, OK, something can take longer than expected. But without profiling the functions the timer is mostly useless. That profiling must be not only based on the number of ships, but apparently also on the distance they are commanded to travel.