Sente: a Python 3 native library for the game of Go.
Project description
Sente (from the Japanese せんて/先手) is a general-purpose open-source python library for the ancient chinese board game Go/Badok/Weiqi. Sente is designed to be a Python 3 replacement for the gomill library.
In addition to supporting Python 3, Sente is written in C++ which allows AIs that use Sente to take advantage of C++'s superior performance.
Installation & Requirements
Sente runs on any operating system with python 3.5, 3.8 and 3.9 and can be installed via pip.
$ pip install sente
-- or --
$ python3 -m pip install sente
Getting Started
The Basic element in Sente is the sente.Game
object which represents a Simple Game.
>>> import sente
>>> game = sente.Game()
By default, sente creates a 19x19 game with Chinese Rules. 9x9 and 13x13 board sizes and Japanese rules can be specified if desired.
note: japanese rules are not reccomended as sente does not currently include automatic dead stone removal.
>>> game = sente.Game(13)
>>> game = sente.Game(19, sente.rules.JAPANESE)
moves can be played on the game using the play()
method, and the board can be printed using the python print()
function.
>>> game.play(4, 4)
>>> game.play(16, 4)
>>> game.play(4, 17)
>>> print(game)
1 . . . . . . . . . . . . . . . . . . .
2 . . . . . . . . . . . . . . . . . . .
3 . . . . . . . . . . . . . . . . . . .
4 . . . ⚫ . . . . . * . . . . . * ⚫ . .
5 . . . . . . . . . . . . . . . . . . .
6 . . . . . . . . . . . . . . . . . . .
7 . . . . . . . . . . . . . . . . . . .
8 . . . . . . . . . . . . . . . . . . .
9 . . . . . . . . . . . . . . . . . . .
10 . . . * . . . . . * . . . . . * . . .
11 . . . . . . . . . . . . . . . . . . .
12 . . . . . . . . . . . . . . . . . . .
13 . . . . . . . . . . . . . . . . . . .
14 . . . . . . . . . . . . . . . . . . .
15 . . . . . . . . . . . . . . . . . . .
16 . . . ⚪ . . . . . * . . . . . * . . .
17 . . . . . . . . . . . . . . . . . . .
18 . . . . . . . . . . . . . . . . . . .
19 . . . . . . . . . . . . . . . . . . .
A B C D E F G H J K L M N O P Q R S T
The Sente board display is designed to be similar to the gomill ascii boards output.
A hash (#
) denotes a Black stone and an "O" (O
) denotes a white stone.
One difference between sente and gomill is that in sente, the star points are denoted using an asterisk (*
)
Finally, Sente also provides the ability to check if a move is legal using the is_legal()
method
>>> import sente
>>> game = sente.Game()
>>> game.play(4, 4)
>>> game.is_legal(4, 4)
False
Further Reading
- Game Trees
- SFG file reader
- NumPy conversion
- GTP (Go Text Protocol) (Coming Soon!)
- Automatic Dead Stone removal (Coming Soon!)
Building & Contributing
Sente uses CMake, git and C++11. In order to build the library, you will need CMake, and a C++ compiler that supports C++11. You can install these using a software package installer like homebrew or apt.
OSx
$ brew install git
$ brew install cmake
$ brew install clang++
Debian/Ubuntu
$ sudo apt-get install git
$ sudo apt-get install cmake
$ sudo apt-get install g++
A sente binary can be built by running the setup script.
$ python3 setup.py develop
To import the resulting .so file, simply import sente in a local python interpreter
$ python3 setup.py develop
$ python3
Python 3.8.10 (v3.8.10:3d8993a744, May 3 2021, 09:09:08)
[Clang 12.0.5 (clang-1205.0.22.9)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sente
>>>
Building documentation
in order to build the documentation, you will need to have sphinx installed and build a development version of sente.
$ pip install -r requirements.txt # install sphinx
$ python setup.py develop # build a development version of sente
$ cd docs
$ make html # make the html
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for sente-0.2.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1358be25f4136b6d76e1c1dc68e2a0a32c509b4578b627b72d5035321434ae3 |
|
MD5 | 18442c452b309dd4ecff0de99f6e2504 |
|
BLAKE2b-256 | d681fa2ea70fd79bb50c8f7b7b4608c7041fcabdd22d9616c000b46af02b761b |
Hashes for sente-0.2.0-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24aaff782bfcf37dc952168944ca5a9681bef29e7a83fb4c062b91ac3cc94177 |
|
MD5 | 7f5b936bb3f642b590cb78f684780165 |
|
BLAKE2b-256 | ded51e1c3d86507d5305cd2b53c7d339652acc06845a06dc3494e72cab350d92 |
Hashes for sente-0.2.0-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | db25b1526a6bd0dbb1d3dde6d9dcbd797b67b38843b965c83a812f4eb937af96 |
|
MD5 | 1027a1ecb16d28ffa619e1ec6e8ebad3 |
|
BLAKE2b-256 | b7d4f6c541be7bc6e937095edf3bc6cbf763801b5ceb2c0cdf560b2ef8596faa |
Hashes for sente-0.2.0-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30e42b90fd57e6e64188471f6e45ae9636b44b25b431a6b607bc91c62c3f9fbb |
|
MD5 | a7cf5ca20ebd01790e5a8204c07d9af3 |
|
BLAKE2b-256 | b4a000b50af58ef2b33c843ff2cc610af8e1a0c58cd0ca9733598f8503dff539 |
Hashes for sente-0.2.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6ae5bc8ddaeedda2b1a5bc4c4a6c5cda75d88c5a160ed1bdfd066358ce0d75c |
|
MD5 | 6a3283e9789bdd76ef06b52941fcaa08 |
|
BLAKE2b-256 | a8b2aa304c15b4959bc90b7483e15e79532a7d21013929a3248c9684ddd885f8 |
Hashes for sente-0.2.0-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5f52aad7f17000972065a92810f4a403a0020ec636ea2de0ac79eff22ebb41e |
|
MD5 | 0a8db0ca90c4b908c034e0a8fadeefb0 |
|
BLAKE2b-256 | 25fce8815a957f3785f9cec891a1b9a85190392121b6e89a2e7eb063510e89fe |
Hashes for sente-0.2.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5808b8e6b586979c9a6c954ab6c2ddc5141dce97f7bb8fc6a3aa5e4a23497508 |
|
MD5 | e27e084ca8083bef15a40394c9c2b67f |
|
BLAKE2b-256 | 2bb587d04cc3c27da714d8d6c18ad0f8efe41c41f72212dcf070ba3e46d7a2fb |
Hashes for sente-0.2.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 659d6b37de129a20a2ecdc5bc771faa5531774616022bc65093a09cceb1159bc |
|
MD5 | 1db107fc9faa8b5370904bd9c573fbb9 |
|
BLAKE2b-256 | e8cebe5adfb1be71233208cb4709577ed161d29d59083b3cae5e19372bcbf766 |
Hashes for sente-0.2.0-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0914084a26498824b8513c30e18949b10d917f09f7c978fc848c817c0db038d |
|
MD5 | 3528882c9509f81c6edd860b899d4512 |
|
BLAKE2b-256 | 273b6bdbda2cc08d1ac8cb1a6b578ea71c266c8a96d6147df685573d5d70c78f |
Hashes for sente-0.2.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57e7496b6b64446936d9ee4cd2b783e4085c7d0d93b3d81f1d0cb16d4b0029ee |
|
MD5 | 4f9540a1e2c293bd1f4035c1ca708dae |
|
BLAKE2b-256 | ab948cd04974bc0494a903715429fd4ef1be3f88c33ed982de1d6eabf22fc4d3 |
Hashes for sente-0.2.0-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ba4060f90f780a5b1df48671ab1e56afbaf31d8ecb4cfb400df532852c8f18a |
|
MD5 | 7582cdbdfda77fc54579216cd2757158 |
|
BLAKE2b-256 | 480acddb950fd9b0d394c9cb9ff0b9b41f61f5ebb774e57413214e5b6c97c185 |
Hashes for sente-0.2.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a301e8d9079a4050c3029dbece65ef0ff5dc94647aa8abc0083c16ff6df2bf7 |
|
MD5 | 487553ef115834885022b4802434ef97 |
|
BLAKE2b-256 | f3e01f37d6ab0142dd419530416aef4cb23beb522e467bc9759809a56cb35814 |
Hashes for sente-0.2.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d940db532198790a2afd97a84c83919ebf49043286c1b7a04fc399a128db9dd |
|
MD5 | b050781e34651a9f8facab53475f8751 |
|
BLAKE2b-256 | 5cf8a4f7994ee3a2a07299cf28988421a7fee20e42b2e870bee65d82467e8883 |
Hashes for sente-0.2.0-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 556e16c66754968523f079f42fbe7f06654671ff3a6f50aaf42e9d6d70cfcee2 |
|
MD5 | 9587009cd071918d0b006f34d5698750 |
|
BLAKE2b-256 | bf541f86b362aea43b595a82882617270221f6d1b074d7482fe15c1fbd6f62c0 |
Hashes for sente-0.2.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fba39512f74f42b22421ffd704924ed840d9eb38afb937069be76a72d1d39be0 |
|
MD5 | 4bc7ce15b812dc0c243f4a7a8abd8ca0 |
|
BLAKE2b-256 | 11fcf8296d138bd73e96963fb34376f5859f6c26cba1e41296c3ca6ac36fcc65 |
Hashes for sente-0.2.0-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19ea234ceec506d6f53dcc3e6fe09237a2a831174298c3e0693e681b28cab8a5 |
|
MD5 | 4127d465aff3c208b35fe111b4cc7b9f |
|
BLAKE2b-256 | 69f92ea13d5d0d92facc0f665dadd3aa46b73eb18ce1a54d87a0412fe5d67d47 |