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

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

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

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

chesslib-1.0.329488327-cp37-cp37m-manylinux2010_x86_64.whl (61.6 kB view details)

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

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

Uploaded CPython 3.7m

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

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

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

Uploaded CPython 3.6m

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

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

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

Uploaded CPython 3.5m

File details

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

File metadata

File hashes

Hashes for chesslib-1.0.329488327-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ec5412fb6871c6af647fc9c58025532643797b13ad1c04330ef57f878717a54c
MD5 58bb06edfbbaee035d7bf9ea8daafbf8
BLAKE2b-256 08062137789cab7efef28ac5b3592c40d3c3b747fbdc36dc63b67da8b74862ed

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329488327-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.329488327-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 9b604e86bf6fd883751fda849b2368d1345a2ec238ec2cfd5aa4ca6e27a1c9f1
MD5 93bdcc16588ea43c080f059c2f67fcb0
BLAKE2b-256 a69565a24460f53d5b2016da29610ade1da6b437c89a8afb99026cb23a314a08

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329488327-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.329488327-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 ebcc4c563b642feb9349d4d35b55abfddc8a163b6f9bed32e1e636094c6d2204
MD5 81d28a3e32d630eba8c279979a49df43
BLAKE2b-256 c8895ab7c3b370f5a331e19636d158a9a14600b86e938398c227240549b02e24

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chesslib-1.0.329488327-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 15047b4e512031c9b4e98ce70c47b0937bb68148f26c5b952bb13f055a60a74e
MD5 b6a30807b81cfd20cdb273979b23dd75
BLAKE2b-256 0adce604d84338ed07d6bd6714c26b104fedf2e26246b0d49af005d88f31be1c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329488327-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.329488327-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 c3315207a61fcbc800addaed13df7d43b2f4c657d5e577a30dfd948734f9b392
MD5 c3d1ed7042da44b7ffe816f6e0cb5675
BLAKE2b-256 153ee961933edb18b8385acf923cb93e7f390c753c1124ece268f779115c327e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329488327-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.329488327-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 9699ae4ea1faa2670ab23dc28d454a12e076db56286a21add1d71ca8527bf355
MD5 3ec6c80dfbd2523342939f6433895db9
BLAKE2b-256 0ed1fada17ee8172b000eb84cc5bff6b218a239dd5d887876c8084f44af25126

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chesslib-1.0.329488327-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9a3ec036ddd263bc34b69597582a906d9b55721b74fff2386f28f1ae826b7212
MD5 8714984d32fe4e1b4dc59a4e8856edd9
BLAKE2b-256 0c33ea681bd9b325a3b830cd762c7e4373ca08583a1c081aecf655ad2b0d6e46

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329488327-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 61.6 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.329488327-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 9173a5c29621f90bff5ceb61d18c226b269461819aea11bb6f76f7de166641f7
MD5 4293bf3d1ec29c385fe2c1ae0be52fe1
BLAKE2b-256 ab397fb3b5a73dac98a1ac30608c8757b89e4ff9dcd4387c5e49900278f97314

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329488327-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.329488327-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 52defda8cf8ef2dda428c76348eced5797905c2a24aa7a54cf14b37b8d834736
MD5 2e5f91d98d27ee6dec7dd54c389b4b0f
BLAKE2b-256 27de9bb0cba490b56e2aa897bff048c0cca535ae537027a12ec889cfe474704f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chesslib-1.0.329488327-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bda922040a96b4871d0d2d0f45ad5ea3be19076c1047df62a6e2088403450fd6
MD5 d662ade8890cb68bc544ff6ff390d29d
BLAKE2b-256 2fd6624771bf5a60a32641b9370fb542250bdf28ccc6eaa9eecdd6a3837acc2a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329488327-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.329488327-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 105f84ce6a800a10e2ef4e34534d127aa2057d406036033744d57a85deb6048d
MD5 29ff3c1ffd71941cc3cf5c7647d4e658
BLAKE2b-256 cdc9e04c2029595c57a11139239c65c59da7cfc16b4c0e7ef1be549f5db0d2f6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329488327-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.329488327-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 539c11c79a2b26cac994eafcab857e963c52f5c8aceefeb04de339746ecc1d81
MD5 602c138167a3ead9bacd370a59b806f3
BLAKE2b-256 762bf893842fbe4e4ec2ce36c1ff1d59415a60fc2d36678ba1cf07d25e0a2390

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chesslib-1.0.329488327-cp35-cp35m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1bb114756238094a8f1969056040fe187edf34581c68efb911ffad692d95e915
MD5 3d5d258838cc4336b0a46cddc0d26b1a
BLAKE2b-256 f95fe1f9a0d1adc78fbc07b283922d61d16039135e78e7bf1bb9ab044f2917da

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329488327-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.329488327-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 31a56fd3a77c1ce771968ef198ce7d008e4ec6f59d3892c11c20590a023430ab
MD5 65af5aaeb4fa008b984aa0eb642741fc
BLAKE2b-256 eeb469035bef4828f0098ed85e4992ca1984dfff2d566de6ab087b5d9612654f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329488327-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.329488327-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 e3d3ad1b592072a85fe407fff83b0a6554387e83b6294fbd8d15cedada51986d
MD5 b139d25be6886795a553f840af0bcb42
BLAKE2b-256 cb6a2235ad867b0540884caa72309db94f20fc5d4a52c554ee8dbea604407fd3

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