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 (Coming Soon!)
- 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.1.6-pp37-pypy37_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96bd55cabd4e216a8ff0f5f11130e676f7d05a1848b07398a992d7a58f4a5ddb |
|
MD5 | 66d9cbbf242ea3b13e0f70565d7f6569 |
|
BLAKE2b-256 | 776b9c882ae26c19efdd43a0e2503f9887a90da032f30bdd1f85a9f826b9d5d5 |
Hashes for sente-0.1.6-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48a3c1e8d68c343ae22728f3763d18d264bf56835b53a9f459fc790abce7b88e |
|
MD5 | 9cafe7c47e95c8bbf70fc28282e7761f |
|
BLAKE2b-256 | f30168b736d1d7c0d00273d1ac30a04cebf23297c758efa61e2b34af38d9cd08 |
Hashes for sente-0.1.6-pp37-pypy37_pp73-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b548ebbb5ed470aedd8507d57e258de01f5b362ab9d03b22c9301f98936cb133 |
|
MD5 | 7f76de37245c7b647ca64f387eabeaa2 |
|
BLAKE2b-256 | 8a1e6d63eb29e4784ed9864ed1efe0c00dd3ac915625431c8498f0554ff887f2 |
Hashes for sente-0.1.6-pp37-pypy37_pp73-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3edb89ea6ef608bbb54cc2da6790b535f33460c1b857655872e3b41dac8d28fb |
|
MD5 | dea28b3370ca5bb4cbb3abf4894ac7a1 |
|
BLAKE2b-256 | 463223a3b65240e6afe99f8e056e987c99df9c8b40c147afd7465ce96b81d4a0 |
Hashes for sente-0.1.6-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf38c827722e6d3c927137f70f54ed83ffb80d3c552a7a7322559ea06f999bf6 |
|
MD5 | 675626f5ea6a55e6bf46c93ab3e41e85 |
|
BLAKE2b-256 | 4f8e70e2b3b506b19b60370ed8f16482c239073bc3fde8a06c2aeb07919e63d5 |
Hashes for sente-0.1.6-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98e752387481e36356dbc364869af1cb5a569fa530d1f2675911c1b6451ae43a |
|
MD5 | 84a1edf93ffa1451fa7d73f5b246ea63 |
|
BLAKE2b-256 | e43ddb14543b2294d3796320b710d87330e53096c35905e6222bd48fc1331fb3 |
Hashes for sente-0.1.6-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7df011336621865784e09c6c0d8cac55668bcdd5f423f62a518a82f514519ce |
|
MD5 | 366db637fc989804ea46ac5701d162bc |
|
BLAKE2b-256 | 121c9c523568315a87a820faead7351307f80c6727b67ed25b5f07302d822989 |
Hashes for sente-0.1.6-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9fb98e44f84234149257ee579d7a46085d60ed8e562b3ebb5528107d537c7e6e |
|
MD5 | 5ab9d29bcb7b4266fe8b24e65aab92f1 |
|
BLAKE2b-256 | 05d3261ed8769558cea573fe17178cc7f1bb1963b420d2a6ad3bc77b800fff9a |
Hashes for sente-0.1.6-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c93d7144f49751576498455fa2f0a957c225410aaff09f186774c26caddf25b0 |
|
MD5 | 8293c13c33e8d80f298d9df661da68ee |
|
BLAKE2b-256 | 9a576946dfb5cf7f8724daed0de9a806764ad07d13e28074c055108e06ebde43 |
Hashes for sente-0.1.6-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c77c8adcacca089561300c4fa2207bb4b6e6ec9ce42d33b5227d4e25098b806 |
|
MD5 | b1a66bf24b1caa0066e0c781d2b6da1c |
|
BLAKE2b-256 | 7db9f0188ad796c3770461c3b7ec0dc4b87fc29be7052c8148c6e623f9bbbbc6 |
Hashes for sente-0.1.6-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e5a06ef311f6540ca349b5d47cfd13446c211f331a0f7fc1dc8df2fbb1333f7 |
|
MD5 | 6f7d4e4f5779600ec539be61b59fa8b6 |
|
BLAKE2b-256 | d79a599732c761268fbf177fb3a4654cead35891e604a82309715d81721c61d7 |
Hashes for sente-0.1.6-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 252ce62873d043973cac69beb86d906907c52cb416a2cde746b1db0c0cfe0523 |
|
MD5 | b7e56321a0b35326abb512acfa9b0f1c |
|
BLAKE2b-256 | 329b34c1de03eff42b881424dc586f749f4705e101b2eb88e3f596bd656a4cca |
Hashes for sente-0.1.6-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 994df2c62778ee7fecc2a675582588f609220b86ed082609e2cb46c1fd349fb0 |
|
MD5 | e786d0a919d354f0bedadd402f44fd65 |
|
BLAKE2b-256 | 33f5fddd6216a152178ae247798d0f5bf1c52c8b7c9091954d7af4b686394bcf |
Hashes for sente-0.1.6-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 577d2a0df793063c34ef281fe1a85d9dd0a42885b674ec4fa02dcff94d2259c5 |
|
MD5 | 6b567ee9c5cb1e540b2cc733d32ad303 |
|
BLAKE2b-256 | 045408eca57ad1c8b0915670b745629306280e7587a66bf57ff7de0bf51227ed |
Hashes for sente-0.1.6-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b77d8577e17bed8586037b5bf9e0549d2b64ec519fb63ffba5fc7499ec1c636b |
|
MD5 | ec845c498b2d099aa501dacfb40ff0f5 |
|
BLAKE2b-256 | c65c68d66a8695f37cb74b1e5c4a66abe2c946cef3c3b802e0332a0fcaaf2d79 |
Hashes for sente-0.1.6-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fbde71467e0614a38dc6cb1657aba49f4c8b56a6bb01a564296f11562123cb2a |
|
MD5 | 5ac8961b4192ae61a826999b14ceb37a |
|
BLAKE2b-256 | 504c8d1813b9dae59f4285e047aa71381087205901bf0327262f28ac1a9517f4 |
Hashes for sente-0.1.6-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f988e6c01e00026505745cfabe175bbd527de45692561a238cf1217fe993b3a |
|
MD5 | 4af3105321dbaf3ef138720da66608e5 |
|
BLAKE2b-256 | 22a4a2a824342408e878f49dc33b126171fe18bfec0ff2cb9eabcc0a3689fc3f |
Hashes for sente-0.1.6-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65495f7e650c1bcd64d8044814ea55739123806206ae44f136fe80bad1f89668 |
|
MD5 | c14f3dd84f2217ce1300a55488c70a71 |
|
BLAKE2b-256 | 22c146d427748b29e12e8235d6136838fa508e579795dcd7a48b51f1cc248f4c |
Hashes for sente-0.1.6-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63acb0288cf54b66bc01ac71e616fc6ba6f7c4608bd3990f11248ced57d337ea |
|
MD5 | ac89264ac6c2269ae16abc63ae345eb2 |
|
BLAKE2b-256 | 68d998bcafa3181a124b4206751a05a18aa3116bdf499144b7259232edc9bea1 |
Hashes for sente-0.1.6-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7e6e49bc478de1408295e77f2f06eb14692c27d6a60b7188208ed908b0110df |
|
MD5 | 3f163be6dfa8028edd4b5d5c8dd11773 |
|
BLAKE2b-256 | be18d12307b00a2e61fb58b4f44512d75ba054c5f8a74abc3418886fb88a3876 |
Hashes for sente-0.1.6-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac7200419586c0d53cdee950a6f68a0d9ff1186868c9e0b7466bbebf3f565579 |
|
MD5 | 058f6ba452a8590b34a6a3f691304e03 |
|
BLAKE2b-256 | 1747417f0ddae075cb82efc2a8df437a9d03bba3c6d44fc3e49c551973f6cb56 |
Hashes for sente-0.1.6-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b23d13ee63e4c5cf5c17b9598078245b81c141a15c29ac28cabefe5c136676d |
|
MD5 | 0ad699577cf935c07ce4c1d6576e65b3 |
|
BLAKE2b-256 | 974d9b3273c09551cfa091dbcf418911925e57837b495a0f9ada0c7d96e0db44 |
Hashes for sente-0.1.6-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 71e0c3270524c3c5dcc4469ea57cfe0ead0a0485f90721467f391a657c65fd91 |
|
MD5 | 25110e215ea84457a5b500e83525674b |
|
BLAKE2b-256 | abd7a09ed89e16c9618d2bde78dbb87d8c4c45b30a4456da87b5bda3b346d7d8 |
Hashes for sente-0.1.6-cp37-cp37m-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d9c6c1a5207269a84c3f9fd9182d49abdb118663be7f7d8789353669bead073 |
|
MD5 | e86c19d182fceddfcbb3630b9b57972d |
|
BLAKE2b-256 | 7aee04a48605e52ecc416c5614bdba453ce8b280024fbe4f2421f6d85c07fe72 |
Hashes for sente-0.1.6-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb77bd8089ca94537cc4ffd258f971f7af4fba304dc790f259fe581dffc08971 |
|
MD5 | 6f853ab13379eb96d027811457710e22 |
|
BLAKE2b-256 | 7209cd23113e1026e3a1f549c088da2c2ab6e472e5834c6bdbb1fbda5bf8c427 |
Hashes for sente-0.1.6-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b34d3747066bf3ace3572cee1ab29cb985188291cbfe4af002f820ceb1b90bc |
|
MD5 | dcd2d3333fcc6cb6d2151e6ffa8f58f7 |
|
BLAKE2b-256 | 35c87e4bf3fa383b4be854ab7350c4f28487df18eec3db756afea58f7b569adb |
Hashes for sente-0.1.6-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9863333103dbe2fb1352bea294ab305bd9ff74f1bfb93c480dacf1cd4967a1cf |
|
MD5 | 14385536426c93f8c846ab9fa082154d |
|
BLAKE2b-256 | b1f33d7c3d19cad4b09e3854cbc058479df7409183d61bab7504748b780cd4a4 |
Hashes for sente-0.1.6-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43a717e61651505f93d535f0db492b470880dcc26491d8a81814d4df09cec820 |
|
MD5 | dcd06e4b2892c9cba80968e3f1146d4f |
|
BLAKE2b-256 | 2f79d0bc9364163b4e4df554e6bb738990f682ec5f2ad773fdff2991aab8fae8 |
Hashes for sente-0.1.6-cp36-cp36m-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82ba70d0d1ff8c2003217267c977961b467ae101c7c0ce1a86cb02a2de94d37d |
|
MD5 | 4ba2ccaae6bf0084b4131139d510154e |
|
BLAKE2b-256 | 4e23b9a20914d36ceb4fe1c715ec2ec8a8870c809e47361085a0a3e69f57e0ac |
Hashes for sente-0.1.6-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55e0764a69b3dfa4c9f2ed0e0a965000fa212bc49b927755b760d9fdcd4f0388 |
|
MD5 | 57e7bc0a217eeaa34377990ecc5ba878 |
|
BLAKE2b-256 | 5e267f310cb0ad3db2ef232d79088de1fd047582e48f724dd384e87930e224a7 |