J-Chess: Play chess in the console!
A simple project allowing you to play chess within your console.
Usage
Requires python 3.10
or later. The package is available on pypi so to play simply install with
pip install jchess and then play with jchess or python -m jchess.
The project was developed primarily alongside powershell but the project should be
compatible with generic Windows and Linux consoles.
If you have any feedback please feel free to share it!
Features
J-Chess fully implements chess logic and rules - including castling, en-passant, promotion and check/checkmate.
It is primarily designed to be played by 2 people at the same computer but it does feature a "VS Dumb Bot" mode where you can play against an opponent who's moves are random.
For demonstration purposes there is also a "Two Dumb Bots" mode where an entire game is played with no user input.
Motivation
This was simply a project to better familiarize myself with programming in python and other lifecycle practices & tools.
I was able to practice using useful tools like git, github and wsl as well as
useful concepts including OOP programming patterns, regular expressions, testing,
documentation, packaging and managing dependencies.
The python tooling modules I used were:
| Utility | Modules |
|---|---|
| Testing | pytest, coverage |
| Typing & linting | mypy, pylint, flake8, pydocstyle |
| Auto-formatting | black, isort, autoflake, pydocstringformatter, pre-commit |
Python code features I experimented with and used in the final project include dataclasses, generators, type annotations and context managers.
Scope
The goal of the project was to practice pure python programming so by design there are
minimal 3rd party package dependencies - in fact there is only one: colorama.
The scope of the project was intentionally minimal, but some fun ideas if I return to this project would be:
- Implementing different guis - maybe through a web app or
tkinter - Implement a genuine AI
- Implement a non-local multiplayer mode
Project Structure
Not counting recursively, there are currently 8 sub-modules/packages which are
published in the jchess whl (plus one module used only for testing). The project
structure can be thought of as follows:
+-----------------------------------------------------+
| pieces ---- board display ------ run |
| / \ / |
| geometry game |
| \ / \ |
| terminal -- action (testutils) |
+-----------------------------------------------------+
Metadata
Release files for jchess 0.101
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| jchess-0.101.tar.gz | 31.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jchess-0.101-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 63.9 kB
Release files / jchess-0.101.tar.gz
| Download URL | jchess-0.101.tar.gz |
|---|---|
| Size | 31.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
832705b006eed052399c262fccaae9d3aaafd2c0a7e5aa8cdb216f5be5154da7
|
|
BLAKE2b-256 checksum How to use checksums |
8bf2497e2ee721bdf5e553b55a04e6363e0d2d8507db4570afc2e5da2d45610a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.0
|
Release files / jchess-0.101-py3-none-any.whl
| Download URL | jchess-0.101-py3-none-any.whl |
|---|---|
| Size | 32.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8072becd86b8ecf76f3d93481088b18ecc74da3be2f8f92a15feb06598780bc7
|
|
BLAKE2b-256 checksum How to use checksums |
8f14d3439ba270156eaaf8396fa0ec7ee22b7ef51eab8b04bb22df9e08d35e65
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.0
|