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

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

chesslib-1.0.333764636-cp38-cp38-manylinux2010_x86_64.whl (63.9 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

chesslib-1.0.333764636-cp37-cp37m-manylinux2010_x86_64.whl (64.7 kB view details)

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

chesslib-1.0.333764636-cp37-cp37m-manylinux1_x86_64.whl (54.3 kB view details)

Uploaded CPython 3.7m

chesslib-1.0.333764636-cp36-cp36m-manylinux2010_x86_64.whl (63.7 kB view details)

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

chesslib-1.0.333764636-cp36-cp36m-manylinux1_x86_64.whl (54.3 kB view details)

Uploaded CPython 3.6m

chesslib-1.0.333764636-cp35-cp35m-manylinux2010_x86_64.whl (63.5 kB view details)

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

chesslib-1.0.333764636-cp35-cp35m-manylinux1_x86_64.whl (54.3 kB view details)

Uploaded CPython 3.5m

File details

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

File metadata

File hashes

Hashes for chesslib-1.0.333764636-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 efac804207b2904cb6faec9227f8bd4c2c12f864fde772b2416303c20b272db0
MD5 d6cec0aec01be65ce9cf7c46e527a66f
BLAKE2b-256 d14ba111195fd2ae5284fa1d5ca228952ab84d6a6eb6ad308a2e3052fc436e76

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.333764636-cp39-cp39-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 63.5 kB
  • Tags: CPython 3.9, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.7

File hashes

Hashes for chesslib-1.0.333764636-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 6fe70a9585f0e7afb772eaec60a0594b7f74bba6a9f140d9f0432ba1b5f55e68
MD5 d8ea22cc49140cbae1978a21f507277b
BLAKE2b-256 1db30e03d100a01b7e250a02157d432348c9567cbbfa0bc759b4fd0dc2a99abe

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.333764636-cp39-cp39-manylinux1_x86_64.whl
  • Upload date:
  • Size: 54.3 kB
  • Tags: CPython 3.9
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.7

File hashes

Hashes for chesslib-1.0.333764636-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 da3e276e31c3ece73d7a99ddb3b58c5b16948825a5e785f7d790fbdf521a3248
MD5 218cb3291ae83723f0044dc4467adf38
BLAKE2b-256 98c4377c75583b543cd06797099129fac08fd1df0ede321437915ba9499871f0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chesslib-1.0.333764636-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e172d018a26e4525cda4749bcc1d4be2d5c3eaaa649307104a502438d94f7dcd
MD5 532d3310a4869676cb36cdf4f2b1fdf6
BLAKE2b-256 e1119bf3fdfd816b57a1b80f4296dbdcd6059a279ecfeb9c45814951affb623b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.333764636-cp38-cp38-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 63.9 kB
  • Tags: CPython 3.8, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.7

File hashes

Hashes for chesslib-1.0.333764636-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 c7cf37330c41f44273f7c4df2f0fd17c89c33ed87e1af481936afe60aba912b0
MD5 ea03c930d6fc2673ea5feaa7afbefd4f
BLAKE2b-256 d04e873b9cc04d61e2712a3d573afcb8b1e8b7164b9882fc0ea0ce608c44da46

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.333764636-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 54.7 kB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.7

File hashes

Hashes for chesslib-1.0.333764636-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 3b99770f2fb6dd898d1152b5cb85c7f3c046eb9f0a03894ae478b6b6a6879958
MD5 d2d1183cb637cf2a5c38a49987973760
BLAKE2b-256 3705323478d016a502686f1966d30254e214ebb8b96050e43bc58a6068298055

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chesslib-1.0.333764636-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1f99f80c64ec4e24257410cf3bdd6b6a227183915ed62013ce8ba5df9f43a73d
MD5 70dfea7e0d042245ff207e543eccf363
BLAKE2b-256 ce564c213fc384a39bd0322c9f1f4829f52c6846446a1e6b58b28e4c5662f4c2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.333764636-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 64.7 kB
  • Tags: CPython 3.7m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.7

File hashes

Hashes for chesslib-1.0.333764636-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 438586cf6be88c97a8d2a18ced4c66c10007197a735778773f32498e4416ad78
MD5 6e1ab9814b9d2f9dd63d983b376360a5
BLAKE2b-256 c255ee100cf3d7a37378b8a13b0793487e73435fbb2c273a649591d6b49c5281

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.333764636-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 54.3 kB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.7

File hashes

Hashes for chesslib-1.0.333764636-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 e4c63f4e280b45aeb021411629dc96d0cb8793712eff79391d5ae0f554fc0f3f
MD5 204a44174e371d3fcb13e517b4b52230
BLAKE2b-256 01a4319e1a5b0ee07148f3a49a5f70c80b0f73b14eb1fabe7af1806979e3bfbb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chesslib-1.0.333764636-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 acc8b2a64c9505e9a9db38cad4ec51a2b9d0de22274109300859c48adf89b7ed
MD5 27e577c4af4a3c2bf82f4a94c0ac4f9f
BLAKE2b-256 0cdb57c923663dfb77bd550e8ef633b0aa7a19d72454b5e3c9a440598894f55d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.333764636-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 63.7 kB
  • Tags: CPython 3.6m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.7

File hashes

Hashes for chesslib-1.0.333764636-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 3518185e8d9c8e19f819b40677988d8b60e56e5648798f8a75ec2064e9584535
MD5 e319ad73987975debf33237b04fb4d30
BLAKE2b-256 b96c15abdec8d1ab218fcfe00403f0ac48711490be75b5b3ad21523bd0755226

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.333764636-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 54.3 kB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.7

File hashes

Hashes for chesslib-1.0.333764636-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 05e5a1c20aa7ae6aacc4bbe4898215ba1a7b1b1067201d469d452200fdef87d4
MD5 9f34dc569ba8493eea30950457a4842c
BLAKE2b-256 1628175dce036b1195f0f89ab071793f5a0b677bf9129d6d8517d29c075aa2f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for chesslib-1.0.333764636-cp35-cp35m-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9ed5edfaccd8d25c4eab34ab2c2c9e5ee14977bad53870265d49a3842a1a1875
MD5 a893f7ee2351b6ae00117cd58c495e6a
BLAKE2b-256 4959ae6efe2d56d98a605564292bfce075448563ce73ddc5dfc2f44d7706340d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.333764636-cp35-cp35m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 63.5 kB
  • Tags: CPython 3.5m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.7

File hashes

Hashes for chesslib-1.0.333764636-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 bc378d8114e252e4864bb3694bb3c062c0c9afa8cd62b66dc46a4eedabcc1061
MD5 a3062c01bcaf4863d573f17a6b0f1ea9
BLAKE2b-256 1511e9701de392eee4f44ce91bcbe553a8053c813b27b071a0cdf425df8dc9bf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chesslib-1.0.333764636-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 54.3 kB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.8.7

File hashes

Hashes for chesslib-1.0.333764636-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 166158339e6c438e4feb03f94b7fbd3775617e144bcd9e29ef240fef69b91e56
MD5 1fc8f9a7d7ac016f8db0c50179a54cf2
BLAKE2b-256 45ebaa3702f4d74c8cb53edb411aef0681d6a3499bc685a35b04fab98b35a417

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