No project description provided
Project description
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:
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cligames-0.2.1.tar.gz.
File metadata
- Download URL: cligames-0.2.1.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab7db7142571bdd87952114858d7b8b7b34fd8ef25fdc50b8ec075f54f82780a
|
|
| MD5 |
bab338dd2bcf92095f94baf696ca0034
|
|
| BLAKE2b-256 |
41c37cd74a8fa130a860c138613edce059c73265a92ad61842f777dd60bfb408
|
Provenance
The following attestation bundles were made for cligames-0.2.1.tar.gz:
Publisher:
publish.yml on tombch/cligames
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cligames-0.2.1.tar.gz -
Subject digest:
ab7db7142571bdd87952114858d7b8b7b34fd8ef25fdc50b8ec075f54f82780a - Sigstore transparency entry: 670683444
- Sigstore integration time:
-
Permalink:
tombch/cligames@ae0ddc7fcefad72ef85d3358f42ec754d56c954e -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/tombch
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ae0ddc7fcefad72ef85d3358f42ec754d56c954e -
Trigger Event:
release
-
Statement type:
File details
Details for the file cligames-0.2.1-py3-none-any.whl.
File metadata
- Download URL: cligames-0.2.1-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b052f3c42ff04a4d8b8294feeaef0b634b8a144d8be323b73432b1da41582b74
|
|
| MD5 |
69f45b19841779498cc574e4971c3b01
|
|
| BLAKE2b-256 |
72ec38eb44923f18f287ce4cab4e9ab5d18dbf4a3d6b2449c580860d2db5ca09
|
Provenance
The following attestation bundles were made for cligames-0.2.1-py3-none-any.whl:
Publisher:
publish.yml on tombch/cligames
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cligames-0.2.1-py3-none-any.whl -
Subject digest:
b052f3c42ff04a4d8b8294feeaef0b634b8a144d8be323b73432b1da41582b74 - Sigstore transparency entry: 670683451
- Sigstore integration time:
-
Permalink:
tombch/cligames@ae0ddc7fcefad72ef85d3358f42ec754d56c954e -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/tombch
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ae0ddc7fcefad72ef85d3358f42ec754d56c954e -
Trigger Event:
release
-
Statement type: