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.329488934-cp39-cp39-manylinux2010_x86_64.whl (60.4 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

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

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

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

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

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

Uploaded CPython 3.7m

chesslib-1.0.329488934-cp36-cp36m-manylinux2010_x86_64.whl (60.6 kB view details)

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

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

Uploaded CPython 3.6m

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

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

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

Uploaded CPython 3.5m

File details

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

File metadata

File hashes

Hashes for chesslib-1.0.329488934-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 38cc4f9eb31f9b3c8a019ee0f4e0b7f6266d9678073e6f04d166ea20efd4a653
MD5 31f2bfaa71323c9f52c31096a89bf5f0
BLAKE2b-256 cf4403ca8e283c83bd8322570024308e8cb66e6603a39f9fa8bae2cb6f5fa457

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329488934-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.329488934-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 6f94d18da2317fdf61efa91114bca462579541e8a605811a4261d0fe050db265
MD5 f737eec54f35a60e396376f885e07d72
BLAKE2b-256 2303d4f15c693c286c7de6ff375080b073345970f8c60ca1a154f1419415e026

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329488934-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.329488934-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 e8c854a2c56b36234fd799827f9b9be7107da01088eeb7b65cda8782808b61c5
MD5 af43604dcd3ed143ed7e1f513a0eb2a8
BLAKE2b-256 6135a369076fcccaa3597a4e32f5b185086dd1c6e89db0ea36386a1c1c1841da

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chesslib-1.0.329488934-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 27c47b1e0c048fba29a9c3db25112d98a9de88508bf2b3a3e7c21efddb4c86f1
MD5 66390435602e9c662dc6331b58142d68
BLAKE2b-256 039e0798cd9de0567891481e1526bf2e8414487f849529c422aced86aac4b5a3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329488934-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.329488934-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 40f7e22c3eab261a4c934e24b758ff48bfd28e3cc7c03dfedeb1ddf09b090523
MD5 faf6018e3b75d9fc7491e2d580044e79
BLAKE2b-256 01700e740152bd888088d5e14a12302ce4fc02e59d73b40f9f87e94f9b5de9dc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329488934-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.329488934-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 efb88ad6599febfa573a4bdae3198c1ef3289ac08142a39b51bdff298ad2d096
MD5 769838eab5e231414e1aafe37ff9d6b5
BLAKE2b-256 425848503ba164e24b799ff41b7de96a5df2e3f130913255eba802a79bb213db

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chesslib-1.0.329488934-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1cdb13621c8f36974e150316131b79691e95834a498397cc8159084f1e103eda
MD5 aaccb21581dcd35bfa6b547b7c106301
BLAKE2b-256 c5f4d72bd674f603456796687073fa9bd41a50c298d6ea20c0a16722505b8cc4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329488934-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.329488934-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 ccbed919fdae5371d40689605a80138e05db53a2aa0f304fdb5571f045f35120
MD5 b5abd6f1620263564785e129414fd674
BLAKE2b-256 47bbeee45204ba1ae88e443d12d92949fa5e9de3183f821455fbe4dd92e8d7fc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329488934-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.329488934-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 b9eb4c531240fcfb5bbc383876fca929646bad5795d7256827337df237768aa9
MD5 a017172fde094af93c6a8b74f589e33b
BLAKE2b-256 f5b5196702bdddeeb93c9a743cabb64af56032028e20adef34a3e79ab0ec658c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chesslib-1.0.329488934-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1a6710407b860aeced0661b1a8324a4471ab13b130bcba6fa787a72eab29a232
MD5 d1eb60dce3bbeccc8cf9c99cbd375c61
BLAKE2b-256 c608163ea46e3446965dc9ecd8eddd50022859d021b5741854adbe47f20028f0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329488934-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 60.6 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.329488934-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 cfa0ff92877c5e4d8a4c84a99b019fdc1e1c4b9fb14412993f4c2708b80f17cf
MD5 55cf3b43bc298bf42adcfcaeb739d2ae
BLAKE2b-256 e9d4ce26ae09a7da10d0a17d1fc03e58e1f6543a2f53fd289cdf3c298b644e10

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329488934-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.329488934-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 8122b6b3458f5f90fa0cae0bc281cfdb5333ab6322d63cd0d1922b455a7c2a35
MD5 f31dcefeb018aa2230a27ed9a3906458
BLAKE2b-256 c619e3f9b2081547f741693c0f718be0f86622177ed4d33eafc59ebe3e6f7313

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chesslib-1.0.329488934-cp35-cp35m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 76ddd3e2af39c341b2905b732ad11baf3c670e75c58eba5f12419bc81133b0a2
MD5 2b63d4b3a364f16eb3d24c6f2d1bd99d
BLAKE2b-256 52b7b638e0270a45788d6dce015e28623945f490d74b52d0b30f4357d0cce53d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329488934-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.329488934-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 8f60fdc5970e89a19c5863580eed8ecd08ece2c41093ea51f059eebf640ef53a
MD5 f9613f26a029f8c51afacdf547bf97a4
BLAKE2b-256 bec69c60c4e065b600960ee92f6fd8713db6946130855797818abc26ac3cc7ae

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329488934-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.329488934-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 633e90c51ef8990f7c9ce9b59329d06e893b17555ffb97e6708e9e00faa45231
MD5 c37e0f48ae769cf46428f9ce2a94eeee
BLAKE2b-256 4ee1f865707e28ffad59b720575533a363e4f405f895a511d9410d6049e4386b

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