Halite Home

How to get the frames before sending init


#1

How do you get the frames (get_frames) before sending init (send_init)? Trying to take advantage of the 15 seconds init time but i cant get the frames before sending the init. If I do get_frames before send_init it freezes. How is this done? Im doing my bot in python


#2

Not sure what package you're using, but in general, GetInit() (or get_init() or whatever your package has) should fill the game object with the relevant data about the map.


#3

Like i said, Im using python and get_frames from game_map grabs all the data from the game environment. Everything works okay as long as i send init with my name before doing get_frames. Once i sent init, i can do whatever but only have 1 second everytime. Im trying to do stuff before sending init to take advantage of the 15 seconds but i cant get the frames somehow before sending init.


#4

Assuming you are using the python starter bot implementation. Before calling hlt.send_init() there is an hlt.get_init() that returns your ID and a GameMap object (it's assigned the variable game_map in the starter bot).

That object already has the initialization information including the map and such. Just use that object like you would normally without calling .get_frame() on it.

Once you have finished your startup processing, then call hlt.send_init() and use game_map.get_frame() to get the next frame.


#5

@Janzert Yes, I am using the python starter bot package. Didnt know there are other python packages. Your comment makes a lot of sense and I get it now. I always thought get_frame gets the squares, didnt realize get_init will already have the starting square positions. Thanks!

@fohristiwhirl Sorry, your reply actually had the answer, I just didnt really get it lol