This is my entry to the 2016 Entelect AI Challenge. The challenge details can be found here https://challenge.entelect.co.za.
Language: C#
Editor: Visual Studio Community 2015
Unit-testing Framework: NUnit Framework
Either of the following two methods will do the job.
- First, ensure that
MSBuild
is installed on your system, and the path toMSbuild
is set inEnvironment Variables
. If the path is not set, follow the steps in this SO answer. - Then a package restore is needed before a build can be made. A standalone
nuget.exe
can be found here here. - The standalone
nuget.exe
can be stored at the root directory of the solution. - Start the Command Prompt.
- Change to the root directory of the solution (i.e. where
Bomberman.sln
is located). - Perform the package restore by running this commonad:
nuget.exe restore Bomberman.sln
- Build the solution by running this command:
msbuild Bomberman.sln /p:Configuration=Release /p:Platform="Any CPU" /t:Clean,Build
- Open the solution (
Bomberman.sln
) in Visual Studio and selectBuild -> Build Solution
from the menus.
I have written a number of automated tests (BomberBotTests.csproj
) to ensure that the solution works as expected. Test data consititutes diferent state files picked from replay files of different matches.
To run the tests, I use NUnit 3 Test Adapter
nuget package, and the steps are:
- Build the solution in Visual Studio to discover available tests.
- Copy the
testData
folder from the projectroot
folder to theDebug
directory of the test project. - I use
Test Explorer
in Visual Studio to view and run my tests. - Click
Run All
in the Test Explorer.
- Download the latest release of the Game Engine from here https://github.com/EntelectChallenge/2016-Bomberman/releases and extract it into a location of your choice.
- Navigate to the root directory of the Game Engine (
Game Engine
), and open theRun.bat
file. - Replace one of the bot directories from the
Run.bat
file with the root directory of this bot. - Open the Command Prompt and change to the root directory of the Game Engine.
- Execute the application by running the following command:
Run.bat
I use DIY hacks for my bot with A* search for path finding.
Due to time limit (2 seconds), I use a state machine approach. During each round, any one of the following actions can happen:
- Stay clear of bombs
- Plant bomb if we have any in our bomb bag, and can score points (or block an opponent) and find hiding block
- Block an opponent if we can destroy her
- Chase power up
- Search for next bomb placement block
- Chase opponent if all walls have been destroyed, and we are losing on points.
- Expore the map if we haven't visited every block
- Do nothing if we can't do anything fruitful.
The solution houses two projects. The application project (BomberBot.csproj
) and the test project (BomberBotTests.csproj
).
At the core of the application project is bot strategy (IStrategy.cs
implemented by Strategy.cs
), which makes move decisions. Bot helper class (BotHelper.cs
) houses helper methods used by strategy class.
Reading of the state file and preparing of the game state is delegated to the game service (IGameService.cs
implemented by GameService.cs
).