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

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

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

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

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

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

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

Uploaded CPython 3.7m

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

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

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

Uploaded CPython 3.6m

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

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

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

Uploaded CPython 3.5m

File details

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

File metadata

File hashes

Hashes for chesslib-1.0.329487848-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dad1227866c4e0128ef385b930f0eb857bff0254f7b74887a48481d8ee2ff2a7
MD5 660e125b9a1cffca9897034773f7fcf2
BLAKE2b-256 7c7fe05828d15aba96a70850b5e814c0ce49dd58deb5e2608d315abf241b69e9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329487848-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.329487848-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 f0fa95398b4943ab0d3041eb75bfe37434991bab3d96cb311db8f23fa092fd2b
MD5 1fd7b3fee44d7daa803f0f1119dcb10d
BLAKE2b-256 dd88288a2fcd0462a744df09e0d5d8c74df2f5386a4b049c5ced9e8493db4350

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329487848-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.329487848-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 e009ee0c9c3aee1cb82daef8309756c089f68cfaa792a0a0557e7d1e6478f1d7
MD5 a06bdbc438a380294ea780e5e83e030a
BLAKE2b-256 d0fcb34127f3aa387e825ead246b6947ed6997303f96b217bca54f2eaf432ed2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chesslib-1.0.329487848-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 03a8f1f04fa1bb6b0704f3b2940fb22d5ccf824461256b1e0a536092fc605ac7
MD5 97490c73b6d6a92d28b221613131422d
BLAKE2b-256 e214a5e8e6b60835bc2d6a5db3e35cce5a108381ca33c9026e8a260bb6ede67e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329487848-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.329487848-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 1fe285d29a8bf8baef23e22d4749080aee18003e0b3af965ad9643f980da4b0c
MD5 7e18d455e7b4bca0795c9f4233eb24e8
BLAKE2b-256 46789aaf2ff327e9aec7b9de0fd1a347fb69390a8f1d353085538d4fe46d96e8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329487848-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.329487848-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 743488ae9d01795e2136db753c34179da4530311c0520500a62506ed5296b9e6
MD5 8b4f4a87722e3904d603fa990e62c035
BLAKE2b-256 287849009d24e020a1bef53011c6f0d1a249749288b94ef12a4eb5906f626bce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chesslib-1.0.329487848-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5cb3df949e9a97475945f580db9632d42399493504c7080b4f6e563f045883dc
MD5 620547276570deb92869f84bb8e2fdc2
BLAKE2b-256 a4930c003cf542c7a080c42c5cfaa55742f71d1124f6a8cdaa47f72502ebfe71

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329487848-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.329487848-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 dd0e518f8d367e811b7f1645fc33cc60aa011b9f1d8ff4679c8dc5d0f4ae0012
MD5 aeec75fde7c97f5c7186cbcb359d2d08
BLAKE2b-256 23dce7f19284abf0198cb2f3d134086923c24e53d468ba712fc1e4d74abf6eea

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329487848-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.329487848-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 54096408ad3100c54315d6ba91d89c2fdd3a78bd386eb31433dbfd1c9def058c
MD5 df106746c6f0562988afb7aa14bf0a73
BLAKE2b-256 ef0aa25034d601628b8616c880854f073fc0e404f36f44ef7ba819665e2e3898

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chesslib-1.0.329487848-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 deb719d7c1fed181206a7580177d813f7ad73d74719714224f40c1ff71ce9b17
MD5 366cc9b58f7bf8f595869aac3a5d96ee
BLAKE2b-256 01b19f84141f3a59e6f037536591654e8ed508e0d238ffbcc0cddbb4873f6cd4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329487848-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.329487848-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 12ba7a1a6e1d78cfd0cc97028ccb8d1957cc848743eabbde0453996b6d64c962
MD5 28a23e557e8438112a4bb3cc00dc0b67
BLAKE2b-256 cb8c869b15e8d0c4b341d31f5f259f2d7e8cc8e345fb9d520ba7ccbf40bd9a55

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329487848-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.329487848-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 91a93d3d75cb2d4c2f72b43163c99cd5265ff139204993e116811bb4e3cc329c
MD5 90236a6135f7ebb2d2c74094e26316c0
BLAKE2b-256 4001c5bd98342975839a845580a05debbb74dbc9303d11d661867eb9cb9b5340

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chesslib-1.0.329487848-cp35-cp35m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1d72b02e63346d8376d102ac0b667944b62205143397eda2b6c51eb3eb856355
MD5 3d3504576eb5b44164684472c1a43614
BLAKE2b-256 19f7cc0d764fb5be4756c1ea4bdb7769c5db376b8ede81256ebe6d2439eb3db2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329487848-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.329487848-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 cca79c009ea77af29bc159a4cc8266b0977246f45d4bc63c67c950a6b44140c1
MD5 dbbb9963c5cc0061c787026ed63977be
BLAKE2b-256 1ff52950a194a2b5cf82086343240a36061fd10b3de8b64c2cccdaecf237451e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329487848-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.329487848-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 1283c9de85e1f4480e5713c262ea0e820e000fef8800380a0c8c8a5c8589ca58
MD5 0bf78b34d4da219b313673260e513c74
BLAKE2b-256 51e23d0f35f045ac347f80b9f8eb5afe64a81a43f577a7bae91165c3d9e27bdc

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