KSquares Docker Image

The KSquares Docker image provides and easy way to play Dots and Boxes against AlphaDots in KSquares. It also provides the means to replicate the experiments described in the thesis Mastering the Game of Dots and Boxes with Deep Neural Networks and Tree Search.

Get and start the image

The image is built upon nvidia/cuda and accordingly has built in GPU support and needs the nvidia runtime for Docker to work as advertised.

wget https://tom.vincent-peters.de/master/ksquares.tar.gz
docker load < ksquares.tar.gz
docker run --runtime nvidia -it ksquares

The container will run a virtual X server using Xvfb and provide access via VNC. During startup, the entrypoint script will print the output of ifconfig and the port of the VNC server. Access to the X11VNC server is protected with a password: ohf1isi8Eo4ohngophee

Volumes

If the Docker Image is used for more than just playing Dots and Boxes, it is strongly recommended to run it with two named volumes. Without those volumes it is easy to loose the result of the experiments.

docker run --runtime nvidia -it --volume="data:/data:rw" --volume="alphaDots:/usr/share/alphaDots:rw" ksquares LargeBoards

The data volume contains the generated training data and logs. The alphaDots volume contains the full AlphaDots repository, including newly trained neural networks.

Arguments

When no arguments are provided to the run command, the Docker container will run KSquares in its default mode that provides an interface for humans to play Dots and Boxes. Besides the default mode, the container offers the following arguments:

Argument Description
bash This will run an interactive shell. Make sure to run the image in foreground to be able to use the shell. This mode will also start an virtual X server with X11VNC.
Competition Runs the Competition experiment that create a neural network from scratch, then trains and evaluates it. The results are saved in /data/exp1.
NewStrategies Runs the NewStrategies experiment that creates a neural network from scratch, trains it on Medium data, improves it in self-play and checks if it learned to do Double Dealing. The results are saved in /data/exp2.
LargeBoards Runs the LargeBoards experiment that evaluates the playing strength on large boards of a neural network that was only trained on small boards. The results are saved in /data/exp3.
EasyMediumHard Runs the EasyMediumHard experiment that evaluates the Easy, Medium and Hard AIs against each other. The results are saved in /data/EasyMediumHard.
PreliminaryModelEvaluation Runs some of the experiments that were executed during the creation of the thesis. The results are saved in /data/PreliminaryModelEvaluation.
BoardPerformance Evaluates the performance of AlphaZeroV14 on various board sizes. The results are saved in /data/BoardPerformance.
data Runs KSquares with the --show-generate argument that offers visual examples of the available data generators.
Berlekamp Runs the AlphaZeroV7 and AlphaZero-Competition with and without MCTS on 13 tests described by Berlekamp. The results are saved in /data/Berlekamp.