Build a Machine Learning Bot


#1

We’ve put together these tips to help you get up and running with machine learning.


Download Training Data

Create a training dataset by downloading historical game replay files via the Halite client.

  • Download the client directly here.

  • Run python -m hlt_client --help to see a full listing of available commands and flags.

  • Download replay files by date:
    python -m hlt_client replay date -t YYYYMMDD -d [destination_folder] ## Date example: 20181022

  • Download replay files by user:
    python -m hlt_client replay user -i [user_id] -l [maximum_number_of_files] -d [destination_folder]

Working with Machine Learning Libraries

Tensorflow and keras are fairly verbose libraries that use stdout, which will interfere with the game engine. Try setting verbose=False. Failing that, you can try patching the value of sys.stderr and/or sys.stdout:
    import sys, os
    stderr = sys.stderr
    sys.stderr = open(os.devnull, ‘w’)
Now run your import tensorflow and keras statements, and load your models. Then:
     sys.stderr = stderr


ML Starter Kit
We built a Supervised Learning bot, and we’ve made the source code available as a starter kit. Get started quickly with our Support Vector Machine ML starter kit.


Halite II Community Examples
Looking for more inspiration? There were some strong ML bot contenders in last year’s Halite II:


Unable to use downloaded training data
SVM Bot Decode Message Error
#2

Hi, could you please tell which packages are installed for python?


#3

Hi, you’ll find a full listing of all the preinstalled languages and packages on the game servers here, as well as information about installing any additional dependencies.