Skip to main content

A set of utilities for generating a compact ID from a baduk board state.

Project description

BadukID

Convert board state to a unique id. Lower ids are assigned to boards with fewer stones.

Installation

python3 -m pip install baduk-id

Usage

from baduk_id.baduk_id import encode, decode

# board state should be a 1-D array with 361 elements
# 0=empty 1=black, 2=white
FLYING_KNIFE = (
    [0] * 19
    + [0] * 12 + [1, 2, 0, 0, 0, 0, 0]
    + [0] * 12 + [0, 1, 2, 2, 2, 0, 0]
    + [0] * 12 + [0, 1, 2, 1, 1, 0, 0]
    + [0] * 12 + [0, 0, 1, 2, 0, 0, 0]
    + [0] * 19 * 14)

flying_knife_id = encode(FLYING_KNIFE)
# The value of board_state will be equivalent to FLYING_KNIVE
board_state = decode(flying_knife_id)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

baduk-id-0.1.2.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

baduk_id-0.1.2-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file baduk-id-0.1.2.tar.gz.

File metadata

  • Download URL: baduk-id-0.1.2.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.6

File hashes

Hashes for baduk-id-0.1.2.tar.gz
Algorithm Hash digest
SHA256 95c8dceebf99d342a204fda630e0bcaa746dd12e6b30744d52db0ab1e03ce74b
MD5 75312a0554085355d0244af2dafedafb
BLAKE2b-256 29508711a2b1d6b4ce6d4793f84914789368cf97c42bd779966d1a2b7d1e3c75

See more details on using hashes here.

File details

Details for the file baduk_id-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: baduk_id-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.6

File hashes

Hashes for baduk_id-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 53400561fc42210af2de9b4415db15fbf2c0d458f860dfe334694eab03b2f6e2
MD5 5a06e72b06a942093a69bf4b7104d588
BLAKE2b-256 ead90fa11d006de7406e95e014716de8c55c781b8910a69fd87eccfc67687891

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