Mini Halite is a Django application that will run local Halite tournaments for your bots.
- Python 2.7+ or 3.5+
- (optional) create a virtualenv for python and activate it
- install dependencies:
pip install -rrequirements.txt
- create database:
python manage.py migrate
- create an admin account:
python manage.py createsuperuser
- install
halite
executable from http://2016.halite.io/downloads.php - configure settings in
lite/settings.py
(see below for details) - run the server:
python manage.py runserver
- add some bots (see below)
- run the worker:
python manage.py runworker
- visit http://127.0.0.1:8000/lite/tournament/ and watch your bots compete
-
TIME_ZONE
: the time zone you want your times to be in. By default it is US EST. -
BOT_DIR
: the directory your bots will live in -
BOT_EXEC
: the command to run your bots. It should be a Python format string that will receive a single argument that is the full path to the bot directory.Examples:
- default (linux/mac):
'{}/run.sh'
assumes you have arun.sh
file in each bot directory that will be used to run your bot - python bot:
'python {}/MyBot.py'
- java bot in a jar:
'java -jar {}/MyBot.jar'
- default (linux/mac):
-
HALITE_EXEC
: the path to thehalite
executable. By default it assumes that it is in the root directory. -
PAGE_SIZE
: if you want larger pages of results. The default size is 10.
- create a directory in the
bots/
directory (e.g.firstbot
) - copy all the files into the directory needed to run your bot
- make a
run.sh
orrun.cmd
file that will execute your bot (so that all bots can be launched the same way with a single command) - add the bot:
- Admin UI: login to the admin site http://127.0.0.1:8000/lite/admin/ and add your bot. You should just need to specify the bot's name (make sure it matches the directory name)
- Command line:
python manage.py addbot firstbot
- your new bot will automatically start competing
- to disable it:
- Admin UI: go to it on the admin site and uncheck the Enabled box and save
- Command line:
python manage.py disablebot firstbot
or enablepython manage.py enablebot firstbot
All of the worker logic is contained within tournament/management/commands/runworker.py
.
The bots with the fewest games will be selected to seed games. Bots are sorted by random() * bot.matches.count()**2
which means that there is still
some randomness in the selection process.
Bots with nearby mu
are selected to compete with the seeded player. Bots are sorted by random() * abs(seed.mu - bot.mu)
which means there is still
some randomness in the selection process.
Replay files are stored in the hlt/
directory at the root. They are automatically gzipped to save space. You can delete them if the
directory gets too large, but then you won't be able to watch replays for those matches.
Error logs (from errors or timeouts) are stored in the error_logs/
directory at the root. You can delete them if the
directory gets too large, but then you won't be able to see errors from those matches.