aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 8d1b437a7b39f5f153abff6c110a31b6eeeccf14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# ctak, ctaklm, and ct1986

## Overview

Details forthcoming, but at a glance:

1. ctak is a C library for the game of Tak
2. ctaklm is a line-mode interface to ctak and a computer opponent
   (for 5x5)
3. ct1986 is a similar interface, but designed for a Raspberry Pi Zero
   running buildroot and displaying output on a character LCD.

## Building for the native platform

    make native

## Building for the Raspberry Pi Zero

Download and extract a recent version of buildroot into the working
directory. Edit `BUILDROOT_DIR=buildroot-2020.11.1` in `Makefile` to
point to the extracted directory.

    make pi

## The computer opponent

Standard adversarial tree search (α-β negamax) with iterative deepening, using a neural network evaluation function for leaves and also transposition tables implemented using Zobrist hasing and a chaining hash table.

The architecture of the neural network is a standard, two-layer dense classification network
```
_________________________________________________________________
 Layer (type)                Output Shape              Param #
=================================================================
 input_1 (InputLayer)        [(None, 28)]              0

 dense (Dense)               (None, 64)                1856

 dense_1 (Dense)             (None, 2)                 130

=================================================================
Total params: 1,986
Trainable params: 1,986
Non-trainable params: 0
```
which was trained on the binary classification problem of predicting the winner from a given board state. As input the network is fed the top layer of the board only (see nn1986.c for details) as well as `flats used/flats remaining` fractions for both players and a single float indicating the parity of the board. At the time of training, on the dataset given by `resources/extract.sh`, this achieves ~75% accuracy on the validation set.

## License

GPLv3+