Are we allowed to pass data to a future turn? Perhaps by writing to JSON or something simple?
There’s no need to use JSON to store data, if you’re using any of the starter bots as a starting point (I’m working from in C# so this may vary depending on your language), it doesn’t destroy or reset the bot between turns, so you’re free to store any data you want within the bot.
Equally, the Game, GameMap and MapCells are created at the beginning of the game, and then just updated on each turn. So any extra information you store within them will remain between turns.
The only objects being recreated are ships and dropoffs which are recreated from scratch at the beginning of every turn. Although, there’s nothing stopping you from overriding this behaviour and keeping them around and just updating them.
For example I have a list of Mission objects with my bot. At the start of every turn these are updated, and then used to assign commands to ships. So a mission may potentially stick around for multiple turns.
That is great to know! Thanks for your answer! It makes sense. I am trying to implement an ant-based algorithm. Wish me luck!
Where did you find to overwrite recreating the ships each turn? I’ve been looking for it and can’t find it.
On similar topic is there any way to pass data to a future game? that would be awesome for machine learning.
just discovered the same things about ship object being recreated each turn, had to create a new map to save all their ids & carry their calculated paths from the previous turn as a seed to the next turn.
You can pass anything to command line args. Like this:
halite ... "python MyBot.py --param1 1234 -x 10"
If you need to pass a lot data use temporary files:
halite ... "python MyBot.py --data /tmp/12312525.temp"
Works well for me (pass about 20 params from optimization algorithm)
In bot itself you can parse them using ArgParser ot just reading from sys.argv.
that’s a clever idea… not sure though if any files can persist on the google cloud servers… guess i can test with the log output.
I think you can replace it with pastebin if your do not need to change this data every second. Or maybe google cloud have their own storage/DB.
I personally create my own gamestate struct and save data between turns.
Between games, I output results and settings to perform blind hyperparameter optimization, relying on heavy sampling to converge my numbers before making a change to my client._