Skip to main content

Python3 library for efficient chess draw-gen functions

Project description

ChessLib Python Extension

About

This project provides an efficient chess draw generation extension for Python3. The main purpose of this project is enabling further TensorFlow AI projects and learning how to write an efficient Python3 extension (using good old C).

How to Build / Test

The commands for building the Python3 extension module and testing it properly are wrapped as a Docker image. Therefore just build the Dockerfile and use the image as base for your Python3 application importing the module.

Alternatively you could run the commands from the Dockerfile onto an Ubuntu-like machine and build the binaries on your own. I'm using the default distutils tools, so making your own builds should not be too hard to achieve.

# install docker (e.g. Ubuntu 18.04)
sudo apt-get update && sudo apt-get install -y git docker.io
sudo usermod -aG docker $USER && reboot

# download the project's source code
git clone https://github.com/Bonifatius94/ChessLib.Py
cd ChessLib.Py

# build the chesslib Python3 module using the commands from the Dockerfile
# this also includes running the unit tests (Docker build fails if tests don't pass)
docker build . -t "chesslib-python3:1.0"

# run a test command using the chesslib
docker run "chesslib-python3:1.0" python3 test.py

Usage

Install the official Python package using pip:

pip install chesslib

The following sample outlines the usage of the ChessLib:

import chesslib
import numpy as np
import random


test():

    # create a new chess board in start formation
    board = chesslib.ChessBoard_StartFormation()

    # generate all possible draws
    draws = chesslib.GenerateDraws(board, chesslib.ChessColor_White, chesslib.ChessDraw_Null, True)

    # apply one of the possible draws
    draw_to_apply = draws[random.randint(0, len(draws) - 1)]
    new_board = chesslib.ApplyDraw(board, draw_to_apply)

    # write the draw's name
    print(chesslib.VisualizeDraw(draw_to_apply))

    # visualize the board before / after applying the draw
    print(chesslib.VisualizeBoard(board))
    print(chesslib.VisualizeBoard(new_board))

    # revert the draw (just call ApplyDraw again with the new board)
    rev_board = chesslib.ApplyDraw(new_board, draw_to_apply)

    # get the board's 40-byte-hash and create a new board instance from the hash
    board_hash = chesslib.Board_ToHash(board)
    board_reloaded = chesslib.Board_FromHash(board_hash)

    # see ChessLib/test.py file for more examples

Roadmap

Following features are planned for the near future:

  • change Board_ToHash() / Board_FromHash() exchange format to Python type 'bytes' or 'bytearray' for better compatibility
  • improve code coverage of unit tests
  • implement CI/CD GitHub pipelines for DockerHub and PyPi releases
  • fix all memory leaks of the lib
  • think of performence testing / performance improvements (especially draw-gen)

Following optional / fancy improvements are to be considered:

  • add fancy travis build labels, beautify README
  • add API documentation compatible with common Python linters

Copyright

You may use this project under the MIT licence's conditions.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

chesslib-1.0.329515153-cp39-cp39-manylinux2010_x86_64.whl (60.4 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

chesslib-1.0.329515153-cp38-cp38-manylinux2010_x86_64.whl (60.7 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

chesslib-1.0.329515153-cp37-cp37m-manylinux2010_x86_64.whl (61.5 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

chesslib-1.0.329515153-cp37-cp37m-manylinux1_x86_64.whl (50.2 kB view details)

Uploaded CPython 3.7m

chesslib-1.0.329515153-cp36-cp36m-manylinux2010_x86_64.whl (60.5 kB view details)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

chesslib-1.0.329515153-cp36-cp36m-manylinux1_x86_64.whl (50.2 kB view details)

Uploaded CPython 3.6m

chesslib-1.0.329515153-cp35-cp35m-manylinux2010_x86_64.whl (60.3 kB view details)

Uploaded CPython 3.5m manylinux: glibc 2.12+ x86-64

chesslib-1.0.329515153-cp35-cp35m-manylinux1_x86_64.whl (50.2 kB view details)

Uploaded CPython 3.5m

File details

Details for the file chesslib-1.0.329515153-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for chesslib-1.0.329515153-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8e39082cf3fb6386fe39fe5653ce3bef1242ba568d6a6da5db79d267ce5fb062
MD5 6b28bd088ba32c1b3c33b7dfc6a9d90f
BLAKE2b-256 e25b1263003e514f002fd31aa076acc74fc7b4758574e889a199918dace54f4e

See more details on using hashes here.

File details

Details for the file chesslib-1.0.329515153-cp39-cp39-manylinux2010_x86_64.whl.

File metadata

  • Download URL: chesslib-1.0.329515153-cp39-cp39-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 60.4 kB
  • Tags: CPython 3.9, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.6

File hashes

Hashes for chesslib-1.0.329515153-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 6da8dd6bb7f46468c0a554769f6cbaf83899837b4f4e8672f8c1004f5e9780cd
MD5 a563b006e9e8c62e995899168d4dcbd0
BLAKE2b-256 21656aa4dd9f1ee9b6cc3ee297671b60a0237a71333cad56279176dc406189c1

See more details on using hashes here.

File details

Details for the file chesslib-1.0.329515153-cp39-cp39-manylinux1_x86_64.whl.

File metadata

  • Download URL: chesslib-1.0.329515153-cp39-cp39-manylinux1_x86_64.whl
  • Upload date:
  • Size: 50.2 kB
  • Tags: CPython 3.9
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.6

File hashes

Hashes for chesslib-1.0.329515153-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 dd9eab0eb41c0c5dbdddc5674aad5de609fd9cf8116cf4a99e1351c15db5c6f1
MD5 46efde044e8475f2e4edd3b08885e0d6
BLAKE2b-256 661bcf860777f8a35641b75d1636e7b754781d5c28d151f8ffc7d480797e55a5

See more details on using hashes here.

File details

Details for the file chesslib-1.0.329515153-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for chesslib-1.0.329515153-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 03b2db03342c4ca5fff24244d66fc4ec2f572e7bf022ec5d39bd8606cfe88b42
MD5 f1e3f2381987f1ff970569e7ec03cf51
BLAKE2b-256 d7c5f3307ced79919b6065216a660d9497e540c98ffc99276913b9c58453fdf8

See more details on using hashes here.

File details

Details for the file chesslib-1.0.329515153-cp38-cp38-manylinux2010_x86_64.whl.

File metadata

  • Download URL: chesslib-1.0.329515153-cp38-cp38-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 60.7 kB
  • Tags: CPython 3.8, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.6

File hashes

Hashes for chesslib-1.0.329515153-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 9c60e430b7000e63c66b91b76bcc9f1f61e8a18471b1543860b0ca534cc90d24
MD5 f50fab28eed78c11b5e0a3f13b64bec0
BLAKE2b-256 9bfa9bbf72c78f4f8421f3faf9bcd431df7e4e166b62645bc28bc2d73cee04c4

See more details on using hashes here.

File details

Details for the file chesslib-1.0.329515153-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: chesslib-1.0.329515153-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 50.6 kB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.6

File hashes

Hashes for chesslib-1.0.329515153-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 4dfa67ecf337283549ea01866da84cecb4fb45b85fd9cd24337c6baa7c4486e3
MD5 34299c897830980b7708f92bdfc77d48
BLAKE2b-256 9672fc3caf389d5aa27e8b0a77c545763a5c2393b4af0aeba9f8a6ff5514e06f

See more details on using hashes here.

File details

Details for the file chesslib-1.0.329515153-cp37-cp37m-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for chesslib-1.0.329515153-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 da45f8028c3561b962bd1ef092a310670df4181080d9055689c968f0a5499d07
MD5 b35a4f66bd9a4a734fe473d3608b32c6
BLAKE2b-256 b065a8bb6f2c6ed33467977e8e422c63b2062cf58c03c6ebbe3e9ebf840ff438

See more details on using hashes here.

File details

Details for the file chesslib-1.0.329515153-cp37-cp37m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: chesslib-1.0.329515153-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 61.5 kB
  • Tags: CPython 3.7m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.6

File hashes

Hashes for chesslib-1.0.329515153-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 e32a5390ced7b9d8da224aed37d713f20642ea5506b30c7cb95daaa89b55ad23
MD5 1ea408e8046c42519f7bf52204ef0f34
BLAKE2b-256 1c7edbdcf7199a6f945b21f4a61406975d9da7501e659276beb11b673f9fd826

See more details on using hashes here.

File details

Details for the file chesslib-1.0.329515153-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: chesslib-1.0.329515153-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 50.2 kB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.6

File hashes

Hashes for chesslib-1.0.329515153-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 17cf8e4c594da56a9ee8694edaa6f185b4c2c4357a6a9fb5598740ebf48eda37
MD5 273a0040722d4891f771094b74f37da0
BLAKE2b-256 2ccc84d09d86d0af692a67cc9a34f6d1c5423ec6265d1376e6e33263de98db87

See more details on using hashes here.

File details

Details for the file chesslib-1.0.329515153-cp36-cp36m-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for chesslib-1.0.329515153-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7ce89a1b3fc29da4cdedc3475d148a819dc5b3cd94d0eb7f1873648cec89c27c
MD5 199355c5419d5e4cf79c256344bc3aa8
BLAKE2b-256 d687a01d642fac14e69e8ff74804fd00f88c1f1213afb6143e455dad3d08906c

See more details on using hashes here.

File details

Details for the file chesslib-1.0.329515153-cp36-cp36m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: chesslib-1.0.329515153-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 60.5 kB
  • Tags: CPython 3.6m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.6

File hashes

Hashes for chesslib-1.0.329515153-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 3e04a8b45ebe19b8a1ba2fbdea41d3d1c1c706f6d0c6feef49ee9debd39e99b6
MD5 6b78d0e80639453d2d08079c33cc389e
BLAKE2b-256 b6462e4389d34c4e17341a6d1e56348fb86edc9e1dc4bafe2b8f3c95bec509ae

See more details on using hashes here.

File details

Details for the file chesslib-1.0.329515153-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: chesslib-1.0.329515153-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 50.2 kB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.6

File hashes

Hashes for chesslib-1.0.329515153-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 843b4303381cd5e7f5b5d40b26b9998526523083bafe0791b15b58f5c4d5f7ea
MD5 266bbba093ad170b9e4773416e5e8c32
BLAKE2b-256 13d0424816a7e1513696e59578555687a321d2da1dd489ba8ffa667eebf98efc

See more details on using hashes here.

File details

Details for the file chesslib-1.0.329515153-cp35-cp35m-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for chesslib-1.0.329515153-cp35-cp35m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9dd7a86b92711fab71b5e5df688f1aa5fb0ce15395c5377e944de882a89adf78
MD5 a27389f92cf37eb0ad828145f18df2e1
BLAKE2b-256 530a4f4e5e3336f76d949a9ebe1288fc390b3d19863cb6d05a25ff324e302ffa

See more details on using hashes here.

File details

Details for the file chesslib-1.0.329515153-cp35-cp35m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: chesslib-1.0.329515153-cp35-cp35m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 60.3 kB
  • Tags: CPython 3.5m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.6

File hashes

Hashes for chesslib-1.0.329515153-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 d6e271726f258c28a7c1898f0616924107926bce007c06368a3808f9037369cd
MD5 fb6fa0a2bb49f108748e2d3ea9503bb9
BLAKE2b-256 8e54d2e75f902054c7f9ff6c5b324f97a79bdd4218cd1d65d28d4e6037c59df3

See more details on using hashes here.

File details

Details for the file chesslib-1.0.329515153-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

  • Download URL: chesslib-1.0.329515153-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 50.2 kB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.6

File hashes

Hashes for chesslib-1.0.329515153-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 ddca2e328deac080869edb84aba1d4186b852ae8feb705db02e9d603087318d7
MD5 391d7172dd9b1a46d67f251d60a52f29
BLAKE2b-256 bcdc478cda555eb45461a2862181f9239d7169bb1713e03c0d23aef6859fb881

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page