Skip to content

NotXia/tablut-player

Repository files navigation

TheCatIsOnTheTablut

Overview

This repository contains an implementation of an AI player for the board game Tablut. The AI has been developed as part of a university exam module for FUNDAMENTALS OF ARTIFICIAL INTELLIGENCE AND KNOWLEDGE REPRESENTATION.

Installation

  1. Clone the repository:
git clone https://github.com/NotXia/tablut-player
  1. Install the dependencies:
cd tablut-player
pip install -r requirements.txt
  1. If you want to use the Cython version:
cd src
python setup.py build_ext --inplace

Genetic algorithm

To start the genetic algorithm to train the weights for the heuristics, run:

cd src/ga-training
python train.py                                 \
    --epochs [num epochs]                       \
    --indivs [num individuals per population]   \
    --timeout [timeout for decision]            \
    --output [weights output directory]         \
    --mutation-value [amount of each mutation]  \
    --mutation-prob [probability of mutation]   \
    --gui

Check python train.py --help for more options.

Run the player

In the src directory, run:

python play.py                              \
    --color [WHITE/BLACK]                   \
    --ip [server ip]                        \
    --timeout [seconds]                     \
    --tol [timeout tolerance]               \
    --weights [path to weights]             \
    --tt-size [transposition table size]    \
    --debug

To run the server you need to follow the guide on the tablut server repo.

Team members