Rakus is a bot developed for Galaxio, the 2021 Entelect Challenge. It uses greedy algorithm, which is outlined below.
The greedy algorithm is mostly implemented in BotState.java
in the directory src/main/java/Rakus. In this file, a custom
data structure called BotState is implemented. Each BotState
consists of two lambda expressions, each implementing a functional
interface.
The first lambda expression is used to determine its BotState score
based on the state of the game. The second is used to specify what
action will the bot do should its BotState for the current game tick
(a tick is like a single turn in the game).
The getNextState method is used to determine which BotState has
the highest score and returns it. The action associated with the chosen
BotState is set to be executed in the computeNextPlayerAction method.
However, no matter what, the BotState ANY is always executed.
The BotState ANY contains every actions that should be done in
every tick.
βββ doc # Contains report for the project
βββ src # Contains source code for the program
βββ target # Contains executable file after building from source
βββ Dockerfile
βββ pom.xml
-
Make sure you have downloaded the
starter-pack.zip -
Download this repository as a ZIP file, extract it, and extract the
starter-pack.zipto the root directory of this repository (the same directory assrc) -
Set the number of bots (the
BotCountfield) you want to run inappsettings.jsonin the folderrunner-publishandengine-publishinside thestarter-packfolder -
Open the
runner-publishfolder and execute the following command.start "" dotnet GameRunner.dll -
Open the
engine-publishfolder and execute the following command.start "" dotnet Engine.dll -
Open the
logger-publishfolder and execute the following command.start "" dotnet Logger.dll -
Run as many bots as the specified value in the
BotCountfield you have set.
To run a template reference bot, open thereference-bot-publishfolder and execute the following command.start "ReferenceBot" dotnet ReferenceBot.dllTo run the Rakus bot, you need to build the bot from source first, using Maven.
start "" mvn clean packageThen, open the
targetfolder and run the JAR file usingjava.start "Rakus" java -jar Rakus.jar
For your convenience, step 4 until 7 can be done with the following batch script. The script runs 3 reference bots and a single Rakus bot.
:: Run this script from the root folder
echo "Building JAR file with Maven..."
start "" mvn clean package
@echo off
:: Game Runner
cd ./starter-pack/runner-publish/
start "" dotnet GameRunner.dll
:: Game Engine
cd ../engine-publish/
timeout /t 1
start "" dotnet Engine.dll
:: Game Logger
cd ../logger-publish/
timeout /t 1
start "" dotnet Logger.dll
:: Three default bots
cd ../reference-bot-publish/
timeout /t 3
start "ReferenceBot" dotnet ReferenceBot.dll
timeout /t 3
start "ReferenceBot" dotnet ReferenceBot.dll
timeout /t 3
start "ReferenceBot" dotnet ReferenceBot.dll
timeout /t 3
:: Rakus bot
cd ../../target/
start "Rakus" java -jar Rakus.jar
pauseTo visualize what is actually happening in the game, you need to use the visualiser.
Extract Galaxio-windows.zip in the starter-pack/visualiser directory and run Galaxio.exe.
Next, open the Options menu and copy the logger-publish path to Log Files Location, then save.
Open the Load menu, select the JSON file you want to load from the Game Log dropdown menu.
Finally, click Start.