Skip to content

noelsimbolon/rakus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

33 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Rakus

Rakus is a bot developed for Galaxio, the 2021 Entelect Challenge. It uses greedy algorithm, which is outlined below.

Greedy Algorithm Overview

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.

Prerequisites

Directory Structure

β”œβ”€β”€ doc             # Contains report for the project
β”œβ”€β”€ src             # Contains source code for the program
β”œβ”€β”€ target          # Contains executable file after building from source
β”œβ”€β”€ Dockerfile
└── pom.xml

Building from Source and Running the Game

  1. Make sure you have downloaded the starter-pack.zip

  2. Download this repository as a ZIP file, extract it, and extract the starter-pack.zip to the root directory of this repository (the same directory as src)

  3. Set the number of bots (the BotCount field) you want to run in appsettings.json in the folder runner-publish and engine-publish inside the starter-pack folder

  4. Open the runner-publish folder and execute the following command.

    start "" dotnet GameRunner.dll
  5. Open the engine-publish folder and execute the following command.

    start "" dotnet Engine.dll
  6. Open the logger-publish folder and execute the following command.

    start "" dotnet Logger.dll
  7. Run as many bots as the specified value in the BotCount field you have set.
    To run a template reference bot, open the reference-bot-publish folder and execute the following command.

     start "ReferenceBot" dotnet ReferenceBot.dll

    To run the Rakus bot, you need to build the bot from source first, using Maven.

     start "" mvn clean package

    Then, open the target folder and run the JAR file using java.

     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

pause

To 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.

About

πŸ€– Bot developed for the 2021 Entelect Challenge - Galaxio

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published