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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cligames-0.2.0.tar.gz
(7.5 kB
view details)
Built Distribution
File details
Details for the file cligames-0.2.0.tar.gz
.
File metadata
- Download URL: cligames-0.2.0.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dde4658928db2ef125384d7ad6111cef53527725ca1b90e674545b3fd8c37961 |
|
MD5 | 8e339a28881b011fc3400ebb5b07777a |
|
BLAKE2b-256 | b4c41da52269b5eba8fc60507a3dc8dbea3d7edb7a3b443ead994004ee3c1a8b |
File details
Details for the file cligames-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: cligames-0.2.0-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a3cd0a817a3c65cfece95999e7d83245fea9c255877f5a33009c4d5ce7df09e |
|
MD5 | d6e394e44ea66773d771fcbfcd1009db |
|
BLAKE2b-256 | 54f0e3fbbf1f20f36c93d0fac3f25f77abfa20689f7effb36555147a266e326b |