/block-battle

A starterbot for the AI Block Battle game

Primary LanguageC++Apache License 2.0Apache-2.0

This is a C++ starterbot for the AI Block Battle (Beta) competition at theaigames.com.

It contains the basic structrues of the game, a parser for the commands emitted by the game engine, an action generator and a basic AI that drops pieces to random columns.

Your AI

Start implementing your AI in myai.h and myai.cpp. The method that is called for every move action is makeSomeMoves. The starterbot contains code from an early version of RandomDrop that drops the current piece to a random column.

The debug parser

An optional debug parser can be enabled during compilation with -DDEBUG_INTRFC. The debug parser will skip non-command messages in the logs generated by the engine so that the logs can be fed to the program unmodified. When the debug parser is enabled, the program will also accept a filename as an argument and it will read that file instead of stdin which may be easier when running the program through a debugger.

The parser supports additional commands:

  • dump will dump part of the current state of the game
  • quit will exit the program
  • hello will print hi!

Build with make

In the terminal navigate to the source directory and type

make 

or

make debug

The binaries will be generated in the build subdirectory. The debug version will have the debug parser enabled (-DDEBUG_INTRFC).

Before switching from normal build to debug build or vice-versa, run make clean.

Build with CMake

mkdir Build
cd Build
ccmake ..

The debug parser can be enabled by turning DEBUG_INTERFACE to ON.

Press c to process/verify the configuration files and g to genereate the makefiles. If everything went well, type:

make

To make project files for other build systems, see CMake documentation. You can use cmake-gui instead of cmake where you can select the build system from a drop-down list.

Publish

To publish the bot it has to be zipped. You can prepare the zip file with

make zip

which will create the file xdata/bot.zip. If you add new files to the bot, don't forget to add them to Makefile.