cligames
Board games in your terminal
- Connect4 and Tic-tac-toe with a text-based interface.
- Playable computer opponent, implemented using the minimax algorithm (with alpha–beta pruning).
- Each board game can be played as human versus human, human versus computer or computer versus computer.
Setup
Install via pip
$ pip install cligames
Build from source
$ git clone https://github.com/tombch/cligames.git
$ cd cligames/
$ python -m venv .venv
$ source .venv/bin/activate
$ pip install .
How to play
Connect4
To start a game of Connect4 against the computer, enter:
$ cligames connect4
A new game has started.
┌───┬───┬───┬───┬───┬───┬───┐
│ │ │ │ │ │ │ │
├───┼───┼───┼───┼───┼───┼───┤
│ │ │ │ │ │ │ │
├───┼───┼───┼───┼───┼───┼───┤
│ │ │ │ │ │ │ │
├───┼───┼───┼───┼───┼───┼───┤
│ │ │ │ │ │ │ │
├───┼───┼───┼───┼───┼───┼───┤
│ │ │ │ │ │ │ │
├───┼───┼───┼───┼───┼───┼───┤
│ │ │ │ │ │ │ │
├───┼───┼───┼───┼───┼───┼───┤
│ 0 │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │
└───┴───┴───┴───┴───┴───┴───┘
Player X - choose a move:
To make a move, enter the column number you wish to make a move in:
Player X - choose a move: 3
┌───┬───┬───┬───┬───┬───┬───┐
│ │ │ │ │ │ │ │
├───┼───┼───┼───┼───┼───┼───┤
│ │ │ │ │ │ │ │
├───┼───┼───┼───┼───┼───┼───┤
│ │ │ │ │ │ │ │
├───┼───┼───┼───┼───┼───┼───┤
│ │ │ │ │ │ │ │
├───┼───┼───┼───┼───┼───┼───┤
│ │ │ │ │ │ │ │
├───┼───┼───┼───┼───┼───┼───┤
│ │ │ │ X │ │ │ │
├───┼───┼───┼───┼───┼───┼───┤
│ 0 │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │
└───┴───┴───┴───┴───┴───┴───┘
Player X chose move 3.
Decision time: 2.556 seconds
Player O is choosing...
┌───┬───┬───┬───┬───┬───┬───┐
│ │ │ │ │ │ │ │
├───┼───┼───┼───┼───┼───┼───┤
│ │ │ │ │ │ │ │
├───┼───┼───┼───┼───┼───┼───┤
│ │ │ │ │ │ │ │
├───┼───┼───┼───┼───┼───┼───┤
│ │ │ │ │ │ │ │
├───┼───┼───┼───┼───┼───┼───┤
│ │ │ │ │ │ │ │
├───┼───┼───┼───┼───┼───┼───┤
│ │ │ O │ X │ │ │ │
├───┼───┼───┼───┼───┼───┼───┤
│ 0 │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │
└───┴───┴───┴───┴───┴───┴───┘
Player O chose move 2.
Decision time: 1.437 seconds
Player X - choose a move:
Tic-tac-toe
To start a game of Tic-tac-toe against the computer, enter:
$ cligames tictactoe
A new game has started.
┌───┬───┬───┬───┐
│ 2 │ │ │ │
├───┼───┼───┼───┤
│ 1 │ │ │ │
├───┼───┼───┼───┤
│ 0 │ │ │ │
├───┼───┼───┼───┤
│ │ 0 │ 1 │ 2 │
└───┴───┴───┴───┘
Player X - choose a move:
To make a move, enter the (x, y) coordinates of the position you wish to make a move in:
Player X - choose a move: (1, 1)
┌───┬───┬───┬───┐
│ 2 │ │ │ │
├───┼───┼───┼───┤
│ 1 │ │ X │ │
├───┼───┼───┼───┤
│ 0 │ │ │ │
├───┼───┼───┼───┤
│ │ 0 │ 1 │ 2 │
└───┴───┴───┴───┘
Player X chose move (1, 1).
Decision time: 1.567 seconds
Player O is choosing...
┌───┬───┬───┬───┐
│ 2 │ │ │ │
├───┼───┼───┼───┤
│ 1 │ │ X │ │
├───┼───┼───┼───┤
│ 0 │ O │ │ │
├───┼───┼───┼───┤
│ │ 0 │ 1 │ 2 │
└───┴───┴───┴───┘
Player O chose move (0, 0).
Decision time: 0.02 seconds
Player X - choose a move:
Metadata
Release files for cligames 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cligames-0.2.1.tar.gz | 7.5 kB | With provenance | Details for cligames-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cligames-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for cligames-0.2.1-py3-none-any.whl |
Total release size: 17.4 kB
Release files / cligames-0.2.1.tar.gz
| Download URL | cligames-0.2.1.tar.gz |
|---|---|
| Size | 7.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ab7db7142571bdd87952114858d7b8b7b34fd8ef25fdc50b8ec075f54f82780a
|
|
BLAKE2b-256 checksum How to use checksums |
41c37cd74a8fa130a860c138613edce059c73265a92ad61842f777dd60bfb408
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2025.
Transparency logRelease files / cligames-0.2.1-py3-none-any.whl
| Download URL | cligames-0.2.1-py3-none-any.whl |
|---|---|
| Size | 9.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b052f3c42ff04a4d8b8294feeaef0b634b8a144d8be323b73432b1da41582b74
|
|
BLAKE2b-256 checksum How to use checksums |
72ec38eb44923f18f287ce4cab4e9ab5d18dbf4a3d6b2449c580860d2db5ca09
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2025.
Transparency logSecurity for cligames 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for cligames-0.2.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 5, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.