This project has been archived by its maintainers, and is no longer receiving any updates.
Chessboard
CLI to solve combinatoric chess puzzles.
Motivation
This project started its life as a coding challenge I was asked to solve while interviewing in 2015 for a software engineering position at Uber.
After the interview proccess ended, I kept toying with the code, as a playground to test some optimization strategies in Python. It is now a boilerplate that I use to:
bootstrap CLI-based projects powered with Click,
keep up with the current state-of-art of Python packaging,
streamline the integration of a data stack (Numpy, Pandas, Seaborn and Conda),
automate testing and quality checks (unit-tests, coverage, coding style and packaging),
provide an auto-generated documentation.
Examples
Simple 3x3 board with 2 kings and a rook:
$ chessboard solve --length=3 --height=3 --king=2 --rook=1
<SolverContext: length=3, height=3, pieces={'rook': 1, 'king': 2, 'queen': 0, 'bishop': 0, 'knight': 0}>
Searching positions...
┌───┬───┬───┐
│ ♚ │ │ │
├───┼───┼───┤
│ │ │ ♜ │
├───┼───┼───┤
│ ♚ │ │ │
└───┴───┴───┘
┌───┬───┬───┐
│ │ │ ♚ │
├───┼───┼───┤
│ ♜ │ │ │
├───┼───┼───┤
│ │ │ ♚ │
└───┴───┴───┘
┌───┬───┬───┐
│ ♚ │ │ ♚ │
├───┼───┼───┤
│ │ │ │
├───┼───┼───┤
│ │ ♜ │ │
└───┴───┴───┘
┌───┬───┬───┐
│ │ ♜ │ │
├───┼───┼───┤
│ │ │ │
├───┼───┼───┤
│ ♚ │ │ ♚ │
└───┴───┴───┘
4 results found in 0.03 seconds.
Famous eight queens puzzle, without printing the solutions to speed things up:
$ chessboard solve --length=8 --height=8 --queen=8 --silent
<SolverContext: length=8, height=8, pieces={'rook': 0, 'king': 0, 'queen': 8, 'bishop': 0, 'knight': 0}>
Searching positions...
92 results found in 119.87 seconds.
Huge combinatoric problem can take some time to solve:
$ chessboard solve --length=7 --height=7 --king=2 --queen=2 --bishop=2 --knight=1 --silent
<SolverContext: length=7, height=7, pieces={'rook': 0, 'king': 2, 'queen': 2, 'bishop': 2, 'knight': 1}>
Searching positions...
3063828 results found in 9328.33 seconds.
The CLI allow the production of a profiling graph, to identify code hot spots and bottleneck:.
$ chessboard solve --length=6 --height=6 --king=2 --queen=2 --bishop=2 --knight=1 --silent --profile
<SolverContext: length=6, height=6, pieces={'rook': 0, 'king': 2, 'queen': 2, 'bishop': 2, 'knight': 1}>
Searching positions...
23752 results found in 207.25 seconds.
Execution profile saved at /home/kevin/chessboard/solver-profile.png
Third-party
This project package’s boilerplate is sourced from the code I wrote for Scaleway’s postal-address module, which is published under a GPLv2+ License.
The CLI code is based on the one I wrote for the kdenlive-tools module, published under a BSD license.
Other resources
Changes for v1.5.4 (2017-08-11)
Show selected log level in debug mode.
Drop support and unittests on Mac OS X 10.9.
Add new macOS 10.12 target for Travis CI builds.
Bump requirement to readme_renderer >= 16.0.
Move installation instructions to documentation.
Move performance page to documentation.
Move CLI usage to own section in docs.
Activate unittests in Python 3.6.
Show environment variables in Travis jobs for debugging.
Check there is no conflicting dependencies in Travis jobs.
Show the graph of package dependencies in documentation.
Fix upgrade of setuptools in macOS + Python 3.3 Travis jobs.
Metadata
Release files for chessboard 1.5.4
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 |
|---|---|---|---|---|
| chessboard-1.5.4.tar.gz | 226.4 kB | Without provenance | Details for chessboard-1.5.4.tar.gz |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chessboard-1.5.4-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for chessboard-1.5.4-py2.py3-none-any.whl |
| chessboard-1.5.4-py2.7.egg | Legacy Egg format | - | - | Details for chessboard-1.5.4-py2.7.egg |
Total release size: 280.4 kB
Release files / chessboard-1.5.4.tar.gz
| Download URL | chessboard-1.5.4.tar.gz |
|---|---|
| Size | 226.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7cab8f693e26a6ea1f381e898ff51ebd303daf1ac3f0d77254e83e87e99b6eb5
|
|
BLAKE2b-256 checksum How to use checksums |
2d7539bc4fa5af5e72abbb1ce067dfa907f580087b82e55362f6127d27719df0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / chessboard-1.5.4-py2.py3-none-any.whl
| Download URL | chessboard-1.5.4-py2.py3-none-any.whl |
|---|---|
| Size | 29.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
7a4cacd4e77d98fa93f05f047b6379e7c7dbed9808f67407a69b907952e423cc
|
|
BLAKE2b-256 checksum How to use checksums |
ca0f14ee176469309d389a27288633174299ab7ebac78ee4474b9a801d30325b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / chessboard-1.5.4-py2.7.egg
| Download URL | chessboard-1.5.4-py2.7.egg |
|---|---|
| Size | 24.9 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
703052428152d808a51b8a1cd22506f8ef20b8e1e09ba11b5f80fcffcb55acb8
|
|
BLAKE2b-256 checksum How to use checksums |
193b76052c79f9713ccca76b06613a04b93d65af435dd7dd86017459b80cac58
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for chessboard 1.5.4
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.