Introduction

Python application Documentation Status

A game of checkers against a computer opponent.

This project is written in Python, tested with version 3.9.10. Pygame is used for cross-platform graphics. A version of this repository is hosted on GitHub.

Checkers window

Installation

  1. Grab a version of the source code from GitHub

    • You can either visit the link above and click on Code ▼ > Download ZIP to download the source code

    • Or you can clone the repoitory using a command: git clone https://github.com/adamsvestka/Checkers.git

  2. Install the dependencies

    This project has 2 dependencies:

    • Pygame for cross-platform graphics

    • Scipy for curve-fitting the AI’s computation time and adjusting its computation depth

    Run the following command to install the dependencies:

    pip install -r requirements.txt
    
  3. And finally, run the application

    python main.py
    

Debugging

The application’s behavior can be altered by setting certain enviroment variables. This is useful for debugging and testing, it is not intended for the end user.

Below is a guide on setting enviroment variables on different operating systems. If you want to view a list of accepted enviroment variables, check out the Enviroment variables section.

macOS, Linux and other Unix-like systems

DEBUG=1 MINIMUM_DEPTH=5 python main.py

Windows

On Windows, you have to clear the environment variables manually afterwards.

set DEBUG=1
set MINIMUM_DEPTH=5
python main.py
set DEBUG=
set MINIMUM_DEPTH=

Building the docs

This project is annotated using python docstrings. The docstrings are written in a combination of the NumPy docstring format and the Sphinx docstring format.

Autodoc is used to grab the docstrings from the python source code, Napoleon is used to convert the docstrings to Sphinx format and Sphinx then generates the documentation. MyST plugin is used to incorporate this README.md file into the documentation. And RTD theme is used to give the documentation some extra flair.

Under the docs directory there is a requirements.txt file which contains all the dependencies needed to build the documentation. The conf.py file contains Sphinx configuration. The Makefile contains the build command. And *.rst files declare the Sphinx directives used in the documentation.

You can build the documentation yourself by installing the dependencies and making against the html target:

cd docs
pip install -r requirements.txt
make html

The GitHub repository is integrated with Read the Docs so a push to the master branch will trigger an automated build. The result is hosted here.

Note

If you do not have make you can run this command instead: sphinx-build -M html . build