Skip to content
Draughts and checkers template library
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example
include
test
.appveyor.yml
.gitignore
.travis.yml
CMakeLists.txt
LICENSE_1_0.txt
README.md

README.md

DCTL: Draughts and Checkers Template Library

Language Standard License

C++ template library for the games of draughts and checkers, supporting almost all known rules variations, board sizes and game objectives.

Disclaimer

This library is currently in a pre-alpha stage. All code is subject to change without prior notice.

Introduction

Draughts is a family of related board games played in many regions across the world:

  • There are many country-specific game rules such as International/Brazilian/Canadian, American/English, Russian, Italian, Spanish/Portugese, Czech, Thai, and Frisian draughts.
  • Draughts is played on checkered boards of dimensions 8x8, 10x10 and 12x12.
  • The common game objective is "the first player to have no moves left, loses". A less common variation is so-called misère play ("first to have no moves left, wins"), also known as "suicide", "giveaway", or "qui-perd-gagné".

Many draughts variants have an official governing body, such as the Fédération Mondiale du Jeu de Dames (FMJD, World Draughts Federation).

Scope

The DCTL supports all above mentioned draughts variants with official rules, on all board sizes up to 18x18. Most existing draughts variants have a high percentage of draws when played between experienced players. Historically, many small tweaks to the game rules have been proposed. Even former world champions such as Herman Hoogland proposed new variants. The DCTL supports some of these variants. In particular, the recently proposed Killer Draughts is actively supported.

Usage

The DCTL provides a series of C++ templates to define the board geometry and game rules of draughts variants. With these templates, one can read and write draughts positions from so-called FEN strings using Portable Draughts Notation. Once a position variable has been initialized with such a FEN string, the DCTL provides further templates to analyze them using a search algorithm, which is supported by a typical board game engine infrastructure of e.g. a move generator, evaluation function and hash table.

Tip

Consult the test-suite sources (under the dctl/test directory) for concrete usage examples.

Road-map

The DCTL does not yet provide a fully functioning game engine that can be plugged into a GUI. It is currently not possible to play a game against a program based on the DCTL. Functionality being planned includes:

Requirements

These header-only libraries are continuously being tested with the following conforming C++17 compilers:

Platform Compiler Versions Build
Linux Clang
GCC
6.0, 7, 8, 9-SVN
8.3, 9-SVN
codecov
Build Status
Windows Visual Studio 15.9.6 Build status

Note that we are currently awaiting AppVeyor support for Visual Studio 15.9 Preview 3, which should fully support building the DCTL test suite.

Boost library

The DCTL uses several of the popular Boost C++ libraries. Current development takes place with Boost 1.68.0. Boost is a collection of header-only libraries, and you simply have to point your compiler to the Boost include directory. Consult the Boost documentation on how to do this on your system. After that, you can continue to use your regular build process.

Installation

Download

Clone the dctl and the accompanying xstd and bit_set repositories to a directory of your choice:

  cd ~/projects/ 
  git clone https://github.com/rhalbersma/dctl.git
  git clone https://github.com/rhalbersma/xstd.git
  git clone https://github.com/rhalbersma/bit_set.git
Test-suite

To make sure that your build environment is compatible with the DCTL requirements, the DCTL comes with an extensive suite of unit tests, placed in the dctl/test sub-directory. To build and run the test-suite, follow the requirements (in particular: compile Boost.Test), and from inside the directory in which you downloaded the DCTL, type (where -jN builds on N cores in parallel)

  mkdir build && cd build
  cmake ..
  cmake --build . -- -jN
  ctest -E "search|traversal"

The build will take less than a minute on a 3.5 GHz Intel i7 (and longer for systems with less parallelism). The test-suite itself takes a second to run. Note that the ctest command excludes all unit tests that do a tree search or traversal (these tests will take several minutes to hours to run, respectively). If you do not see any errors, the tests succeeded. Congratulations: your system supports the DCTL, and you are now ready to start coding!

Note

Your application is completely independent of the test-suite. Building and running the test-suite is a sufficient but not a necessary step in order to use the DCTL headers with your own application.

Build your application

The DCTL is header-only, which means that you do not have to link your application against a separately compiled library. Furthermore, even though the DCTL is dependent on Boost, you do not have to separately compile Boost yourself, or even #include any Boost headers. Simply point your compiler to the location of both the DCTL and the Boost headers, #include the appropriate DCTL header files into your application, and then continue to use your regular build process.

Contribute

Any feature requests, ideas and contributions are much appreciated! The recommended way to contribute code is through GitHub pull requests.

Acknowledgments

Special thanks to Aart Bik, Ed Gilbert, Fabien Letouzey, Walter Thoen and Wieger Wesselink for encouragement, testing, and exchange of ideas.

License

Copyright Rein Halbersma 2010-2019.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

You can’t perform that action at this time.