Skip to main content

Python3 library for efficient chess draw-gen functions

Project description

PyPi Release Docker CI

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).

Usage

Install the official Python package using pip:

pip install chesslib

Use the chesslib package like in the following example:

import chesslib
import numpy as np
import random


def 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 tests/ folder for more examples

How to Develop

The commands for dev-testing the chesslib are wrapped within a Docker environment. Therefore build the 'Dockerfile-dev' file which takes your source code and performs all required CI steps (build + install + unit tests). Afterwards you may attach to the Docker image with the bash console interactively and run commands, etc.

# make a dev build using the 'Dockerfile-dev' build environment
# this runs all CI steps (build + install + unit tests)
docker build . --file Dockerfile-dev -t "chesslib-dev"

# attach to the build environment's interactive bash console (leave the session with 'exit')
docker run "chesslib-dev" -it bash

# mount a Python test script into the build environment and run it
docker run -v $PWD:/scripts "chesslib-dev" python3 /scripts/test.py

Advantages of this approach are that it simplifies the dev machine setup a lot as you only need Docker, git and a good text editor on your local machine. Moreover you don't mess up your dev machine when trying to build and install the chesslib package for debugging again and again. And most importantly you keep your local copy of the git repo clean as all temporary files are created within the Docker container, so you basically don't need to worry about accidentially including build files into git commits, etc.

For a quickstart, set up your dev machine as a VM (e.g. Ubuntu 20.04 hosted by VirtualBox). After successfully creating the VM, use following commands to install all essential dev tools (git, docker, good text editor).

# install docker (e.g. Ubuntu 20.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 (if you haven't done before)
git clone https://github.com/Bonifatius94/ChessLib.Py
cd ChessLib.Py

# install the 'Visual Studio Code' text editor (optional)
sudo snap install code --classic

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

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

chesslib-1.0.329564886-cp38-cp38-manylinux2010_x86_64.whl (60.9 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

chesslib-1.0.329564886-cp37-cp37m-manylinux2010_x86_64.whl (61.7 kB view details)

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

chesslib-1.0.329564886-cp37-cp37m-manylinux1_x86_64.whl (50.4 kB view details)

Uploaded CPython 3.7m

chesslib-1.0.329564886-cp36-cp36m-manylinux2010_x86_64.whl (60.7 kB view details)

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

chesslib-1.0.329564886-cp36-cp36m-manylinux1_x86_64.whl (50.4 kB view details)

Uploaded CPython 3.6m

chesslib-1.0.329564886-cp35-cp35m-manylinux2010_x86_64.whl (60.5 kB view details)

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

chesslib-1.0.329564886-cp35-cp35m-manylinux1_x86_64.whl (50.4 kB view details)

Uploaded CPython 3.5m

File details

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

File metadata

File hashes

Hashes for chesslib-1.0.329564886-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 29e256fdedb85e6e9e3143f165c2c46a3aa6e34105f5b398db0ec43d063489c8
MD5 a7f570a8c3639d49484a33bce4f25674
BLAKE2b-256 a53303c00fad6ef99829bd4957162fcea121c990563de80304014837983f4c40

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329564886-cp39-cp39-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 60.5 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.329564886-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 1b5fa8ab23a9c9136c5889e76592c51345758a44c86f6107ab26ab42156f1715
MD5 ed7940ced1f304911c1eed5613fbab3e
BLAKE2b-256 0d3a3aeaea10a57b24ecad0b524aa04494160d11b3e42896373277811d44f443

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329564886-cp39-cp39-manylinux1_x86_64.whl
  • Upload date:
  • Size: 50.4 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.329564886-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 73c0930d3b97d281752505f39cb7d655f6525a0e2c51fc2ddf431d38368ec84f
MD5 1aae8f4c80c633510cc660edcc93d712
BLAKE2b-256 f6d0c9f9a88a71d6a15bcebf94f8d6cdf6be7c5417fcef9dba7c21d2fc6e6fe8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chesslib-1.0.329564886-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 47e77e896487bac31157a45ae92f19d88a9fee8501035134b352cc86d45137f0
MD5 1f998929828375373b557fe437562652
BLAKE2b-256 3c39555d8dfa1b3a28738d2616f3ac0209e7f504ff051be3f54b56ef3dbf4697

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329564886-cp38-cp38-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 60.9 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.329564886-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 76fc6c1e8fbeaad2ce16ae79fe67822442600ce56d7320583f9ee790c8143d6f
MD5 bbdac8fa02d4bf792e94b37692459650
BLAKE2b-256 7b8836dbb8a16c33035066065a19e38da6469f06289d96e6d01ef513440b307e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329564886-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 50.8 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.329564886-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 05739c60c7dd10b4b165cb21349e5233ad835386df4e5571566c318e855ff82f
MD5 7e94586632de3df29fcbaf7e4544ce4c
BLAKE2b-256 b7c8415c1b2155a34749ba6912c37e55b4661a6da638eca79ebec9d39164e042

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chesslib-1.0.329564886-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a1838d996bd6ef38ec9c87ace15647a8017b16ab67658190db303597938bf926
MD5 9d0ad3185db8020284e2a0a798aa8367
BLAKE2b-256 5f2afbe665100c985ac83a732e4ed38659279974d780eb5729b3605afa64265a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329564886-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 61.7 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.329564886-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 99ddf6d6fdc0f7bfcb33edb43974cf3867d564c9a4ec2585ec629dd310893d77
MD5 d150828fc87505edfd3088ce2f0a901b
BLAKE2b-256 6db0f4e995e8b7aaa58ffd8f15def8451fd77598933b6a5fe62cbf7c06ef5d29

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329564886-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 50.4 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.329564886-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 5cd31cd6244f1965de8b09a69d3622710e781ec79da9399047baeec7874bedb5
MD5 9706556cf9ef185aa1aac0d182c9be31
BLAKE2b-256 961b599191c043dbed87303d9b0c8a693e8c8b8bdb4856f7c72daa0fe8a2dc7d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chesslib-1.0.329564886-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 69af35c4db0710677285b051c3d7a2eaa9a902b0a3c5d0f9ed8a430d78efad08
MD5 1a69d43b1bc0f6d0d23121519e16010a
BLAKE2b-256 d8451694d1131a4a69d7b2680d01824a4e7f11379ab2bdfff59ef51bc5b25906

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329564886-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 60.7 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.329564886-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 509944943a5a3bb00e3c960987232c1d5cb4bc98ad7a084903a9a5c45c9b1eea
MD5 bdff13f197f0f8bcca387150f3435a23
BLAKE2b-256 5f507413ed826222b8a67f9fb7323ed1920da16cc8481b50c9c221c08bbd843d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329564886-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 50.4 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.329564886-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 71da98e0ddaff836c09c29a6817ed472bdf4d6b0d1066a8304fdeac0dfa55903
MD5 c4e9a8eb77b4e81abd686c0718311d48
BLAKE2b-256 83701f313c82483a7d92e50f291a18f48ac55366b1c52b3415d9744f762e31e5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chesslib-1.0.329564886-cp35-cp35m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9136875213480f09d18d9c049a08b40ae2ccdd93221f7dc9b8230d9cc9232d0b
MD5 ae957ce0fb6143081c95d2072dcd698d
BLAKE2b-256 d587f1bd590ec235a084334a117f350feaae426230493c1ffee665f8b064746a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329564886-cp35-cp35m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 60.5 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.329564886-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 27805ad23345c0c548e907797509b14d8a19bde87f7dafd1a1c800dab42e9c2b
MD5 2de8d1aa3b2b4514cb70eed65cae4f38
BLAKE2b-256 c4f70946d6987cdbabfa31c8c997fbb1d654a2e510bb90d2d421219358a38ff3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.329564886-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 50.4 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.329564886-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 d5ddff51190f3a821176f75dccdc671b1b578ad97aca0df474422f2d99b2fd95
MD5 94c7c72bb213c963fb8829afb90d91b6
BLAKE2b-256 7e8c383bf0d7a4e0e6b4940cd33bad477bbcce59e033f5d18ea9ab8678be213d

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