Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jqhoogland/international-draughts

International draughts in the terminal with Python.
https://github.com/jqhoogland/international-draughts

Last synced: 10 days ago
JSON representation

International draughts in the terminal with Python.

Awesome Lists containing this project

README

        

# (International) Checkers

> An implementation in Python.

---

## Get Started

First make sure to install the requirements (preferably in a virtualenv):

```python
>>> pip install -r requirements.txt
```

If you want to see a sample game (note: the transcriber seems to have made a mistake at turn 48):

```python
>>> python checkers/checkers/sample_match.py
```

If you want to play (PVP alternating input):

```python
>>> python checkers/checkers/repl.py
```

## Philosophy

The code's mostly functional (i.e., it tries to avoid mutability and delegates side-effects to an `io` module).
It tends to avoid objects/classes with a few exceptions (especially to make use of python's nifty special methods).

---

## Rules

### Starting position

- **The Board**: The game is played on a 10 x 10 "checkered" grid (starting with a dark tile on the bottom left).
- **Piece Placement**: Board are allowed only on dark tiles. Players start with 20 of their pieces filling the dark
tiles in their four closest rows.

### Movement

- Ordinary pieces move one square diagonally forward.
- Ordinary pieces can capture by jumping over an enemy piece into an empty tile two squares forward or backwards (along
the diagonal).
- A single piece can make successive captures (but capture pieces are not removed until the end of the turn and can only
be jumped once).
- A player must obey "maximum capture" and choose the move that captures the most possible pieces.

### Kings

- A piece becomes a king if it *ends its turn* on the far edge opposing the player.
- A king can take multiple steps in any direction.
- A king can jump over and capture an enemy piece any distance away and choose where to stop after.

### Endgame

- A player loses if they cannot make any valid moves.
- A game draws if:
- a position repeats itself three times, or
- the players end up with only (equal numbers of kings), or
- during 25 moves, there are only king moves without normal piece moves or captures.
- after 16 moves if there are only three kings, two kings and a piece, or a king and two pieces against a king
- a player proposes a draw (and there have been at least 40 moves).

---

## Notation

Dark squares are numbered from 1 to 50 starting with the leftmost square in the top row, moving left-to-right, then
top-down.