Alternative Machine Learning Model Starter Kit


I’ve been going through Deep Learning and the Game of Go and wanted to apply some principles I picked up. So I built an alternative ML starter pack for halite3.

My encoder just extracts useful information from the json game file (e.g. halite, ships location, structures, moves).

The generator takes an encoder and generates training samples based on normalized values relative to a given ship, with your ship being in the center. So for instance, if your map is:

0, 1, 2
3, 4, 5
6, 7, 8

and your ship is on tile 0,2 (value of 2), the relative map will be

7, 8, 6
1, 2, 0
4, 5, 3

It then stacks 4 useful maps on top of each other and normalizes. The maps are halite, ships, structures and how many times the current ship being evaluated can move on each square. The ships and structures have values of 1 for friendly, -1 for enemy, otherwise 0. The halite and move layer are normalized by dividing by the max halite on the initial board.

These maps should be enough to build a model to predict moves.

I have a few examples in the file below on how to use it. I’ll add more detail in the next few days if anyone is interested.

Reinforcement Learning
How to use replay files to make a CNN for my bot

Thanks for sharing. I would be interested in seeing what other details you had.


Thx, esp for battles I think a ML type model with exactly those values could be really useful.
I’ll try to convert some of the date you collect into a JS model for inspiration & battles, the top bots seem to have a protocol for who gets to collect the high halite square between two opponents ships.

For collecting the board halite efficiently, the current game time is also really important, much of ML is the finding and defining of the features from almost infinite dimensions into something that can go into the model.