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.4-pp37-pypy37_pp73-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b814f1d8b0505c0330e427f978dad2291beeffc19360d151be99a899fbb7907 |
|
MD5 | bd7fc402c9dd4f18d01b0da55d0c79be |
|
BLAKE2b-256 | 214d5ac66ab3e62e12c4b1744e46d423c7fa31931e3b18a3e93b40394a132b57 |
Hashes for sente-0.1.4-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb4f6836188fdea60ff2479f39c815ef100aa50dce083b2c884e42b846cc383b |
|
MD5 | c2a3d93d125445c66658c8ded0e4093c |
|
BLAKE2b-256 | 8e24151dbdde4bc46bde55f589813dd0dd3f625268cadeabf586f4bc799da2dd |
Hashes for sente-0.1.4-pp37-pypy37_pp73-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b606388f41ec21c53225eeecdac0b2b2170fcf6e503c95ef2d4d5204d47069c |
|
MD5 | f535730015dd0ecb4f2a13ab7f284059 |
|
BLAKE2b-256 | dc9f7fbce87ef84e20989a99c8f99b29a3980cfc730d551c9e56b2ddfa398667 |
Hashes for sente-0.1.4-pp37-pypy37_pp73-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 40d0dbeadd9201c6c865fdbd64cd2503a128732b513fbaec73a3de3544c7a440 |
|
MD5 | 43ebea382ec4e6e156ee477b255e18c2 |
|
BLAKE2b-256 | 5614610dc345fa4c929e4a46012ee445c136f284e304067b53b8c5199ded8f56 |
Hashes for sente-0.1.4-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1356fb6a48a272b4598ca701cce1d2d92e456f2b06f496bef2228675a6dd8a02 |
|
MD5 | 85dac874c1add04d13e1087c59c803c0 |
|
BLAKE2b-256 | 9bb45946393180ca8fb7016c5746612d67ba349bfdfdeb716e4daf6e1eb75dcd |
Hashes for sente-0.1.4-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28cc09352b6e3661dee781afd07631d5ef3ffffe1a1e99803683953e096960b8 |
|
MD5 | ece5beadf07abcc66cccc7e8c1bc087c |
|
BLAKE2b-256 | 9dbda525c520dd14bc1705a78a65f07a067f29928db7fe95fd1014a778516989 |
Hashes for sente-0.1.4-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0fa16ac4f91d9a07a5a3354c7d79ede715b4d81da4550f1131a8261d4d8ad110 |
|
MD5 | 700ff09eb626601e2b986a1cfd7892bb |
|
BLAKE2b-256 | 6e7b254deb4733755e237f017d87e729bc2cdb474f15d487f045d4db87a43cfd |
Hashes for sente-0.1.4-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f214232fe24cecb0ecfb1b69fd43dc2accdf0d0fa9e2e85f052bd5a9dec1c43b |
|
MD5 | 88176d68cbd2b2b3695ec76d758e6aba |
|
BLAKE2b-256 | a8b71aa4768b2d184efed305b17d5305f0ce9c2d592c84ddb79b9ad506338d42 |
Hashes for sente-0.1.4-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4ffd5a1b766a61cbdb92c609803075aeb4c895b062bac8ac69b7d77bcae021d |
|
MD5 | fa564881ce98b45a63028e74da0f0bf1 |
|
BLAKE2b-256 | 1173713a4415cb588fecdfc29609dcffc89bc6c43e7435291e2754de362d5553 |
Hashes for sente-0.1.4-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2930edf1f4ec5eb8f091fd3160d043cd932a0ca4ba6688ce85fa0bef5b13a250 |
|
MD5 | b05e5b8579328fa145a68c7a0f1a2340 |
|
BLAKE2b-256 | 3fc753443aa23a42c9dec94020e0fd4833cc8d0a10e80a809fe105981a815da8 |
Hashes for sente-0.1.4-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a4ee4c0f14b351d61177f442a12c2056b2ebbad8d85c6fa7b6eef3b201ce754 |
|
MD5 | 7258d95c68431ff5e8a87f7c08b49494 |
|
BLAKE2b-256 | 27f0cab779fe66eea50899ef9f12c235165938290177494e0cc02f6e2bc3e6a1 |
Hashes for sente-0.1.4-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e73ed2b8927150105b47744dab797950fe6f7ceea279bc2c5e8bbafa58eb9667 |
|
MD5 | 11cad5188f127f41d48837e194d6c799 |
|
BLAKE2b-256 | fd0de6d0d59512393f6a2cfd684fc9c8306d2cd0bfa7d1ae383043e76653dbc2 |
Hashes for sente-0.1.4-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a33f7ec6df9de087cecdb30d37245a983646aef1c75c78992b4f5ebeeb2a913 |
|
MD5 | ec2ea3c7ce0b6c7b54249a155334cf50 |
|
BLAKE2b-256 | 6b7682c671594fb5fd7bfc286d831bf25adf2fed3aa94d042bb3ccd809ff3f18 |
Hashes for sente-0.1.4-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c12369f43073b98137f094e297d38a5176365cb0c33a5d29646468c85d692c8f |
|
MD5 | 7b9132364c0a1f96d54f687c63f10731 |
|
BLAKE2b-256 | c12c73a1a93dcd78e9527d9ad3dbba9661158a4168da0163d07dc7662d0fdc13 |
Hashes for sente-0.1.4-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8cfad79a31b0c29e0e0380ab38ebf9fb263011d9cbad259f4b522f7736699b3b |
|
MD5 | a0b3126ba7f3b0e27a231877bf7127fa |
|
BLAKE2b-256 | bcf549f1b95c5bb9b39e750c77a303e5b7cc12b2ad4d08d75453e71ffb52690a |
Hashes for sente-0.1.4-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98918d12ef3b27a531a13424e451533691d532ac71e758760042e85e6c189a6e |
|
MD5 | 2323f45787a58618ac7de8b619466185 |
|
BLAKE2b-256 | 6e6172898bd1618d74cb482c4efa21775171d05d8678f55405a14e0691b990e4 |
Hashes for sente-0.1.4-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03de7f9e3b53231c5534b5f01b3fb39995d38e784d79bb1d996bdaaed3e3b1e3 |
|
MD5 | 762948ceaa2c7c6fc132a0302ddb63c3 |
|
BLAKE2b-256 | fa3d33aefee51820a41e7ad8f0476b8a7f3560ae6dd5a49f600a36aa3e3f00e1 |
Hashes for sente-0.1.4-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff4065a1d09b3df7f0c76755e5439f1acf6ba26b2a5c05ebaa07242f3b7a5adb |
|
MD5 | 9d9294a615cfa776bd74588d8ea03b07 |
|
BLAKE2b-256 | 0ba5a84bd08d500573d81109a831d1dba88e5a22268c8ad6136ddbcf2cef3b39 |
Hashes for sente-0.1.4-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5419e548a3f7d16078e9ccc6cfeb35607f8d4219dadc163c3fb188e8c7b937ac |
|
MD5 | ac024cc15ed984bf1a32eed1033b247d |
|
BLAKE2b-256 | f384ffd44640a11969d3c1467870eedfb215df00552bd0ac8c1b30e8cb96c1a3 |
Hashes for sente-0.1.4-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0735f5022a9434b887557d651e8452ebf234193e62f8aec9bfc67622d682a986 |
|
MD5 | c7a4ab57aa72e9939b6562092246518b |
|
BLAKE2b-256 | 84f353435cc58c4f42b12b51fb5088f5c2601d7d7c249d366e28b6ce78fbd6eb |
Hashes for sente-0.1.4-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb9f4d5824de1f6bb58b635ea1fe782f7f8a8a3508abe12a331f67fce2f3d3ab |
|
MD5 | 73e944424e9a3ba4f135570227820ab0 |
|
BLAKE2b-256 | 9c508f2ee98d4c6da1f7cbfd06dd715cf63488c7818dd9ca8ef7af1f68dafaf5 |
Hashes for sente-0.1.4-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | be523006cbfc1a728f7a2b3f01b9427113ba9b685294b99a27de81eca06b3189 |
|
MD5 | b58e23cb2c110c7daaf0e0738485add1 |
|
BLAKE2b-256 | 4a62e7b08b964211f2c77e2c3a6cf1a3dede6bdea54a65625a2f70e9cba422fc |
Hashes for sente-0.1.4-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18a22e989152d19b56fe52920564cfd036d17e27786718256772fe2413dd4546 |
|
MD5 | 0b3785886d1492e23f506e399fc76b54 |
|
BLAKE2b-256 | b7fe079aa28719466a88c316ffe423b12f6330d3250d2eff272f46680fd1fb01 |
Hashes for sente-0.1.4-cp37-cp37m-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 744618fb838095af0c4849343f712d93eb3c8170b27339e9635ac2029c3dddcb |
|
MD5 | 67afb80a4429c52c9ea8da4e20756436 |
|
BLAKE2b-256 | 8094a7e8d4961aef87de569e658d1bfd98b7396e357c6144133d9bace4e98e72 |
Hashes for sente-0.1.4-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1372b270da646e94d24a2eb5c4572e9ed541d3cdc2e8e64050d383c5ddd58dc1 |
|
MD5 | 2c5be187629d776392cd89f67b5a2563 |
|
BLAKE2b-256 | 91f20e98ed48f991e44d74c5f962ea2b87f2fad4c1a3ac6922165eb308c6601b |
Hashes for sente-0.1.4-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9039001ed0f4e71f84d43c0903ce0e33a610f43c277a02a4962f1727e9913d6 |
|
MD5 | 59b98a153bc05bd82572ac14b7215930 |
|
BLAKE2b-256 | 68b99684405da85d3e1ec4dfc483d1b3f48c104bfd21e17dcd53e8a06c757fe4 |
Hashes for sente-0.1.4-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a2f99f3e50ada4fb9a6675f06e3e1d12cb7691608290565f90a2fdb663b48e9 |
|
MD5 | 72cce4598826f2db57ccf0d71db5d32e |
|
BLAKE2b-256 | 4de5dfe0f51e6847045442aa143ecf1b37c7a31ae19ce921c5098594c3a49988 |
Hashes for sente-0.1.4-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de7fdc04143833312376230627d33f26a0ff85f1e1089c3e2241ed3eeb98c48a |
|
MD5 | 7484cfe32c6b342e646bc252c559cf9b |
|
BLAKE2b-256 | 8da8e223aece67ed539df6561883fc9eb7e6654be4a9fff611a7678bc0295525 |
Hashes for sente-0.1.4-cp36-cp36m-manylinux_2_12_i686.manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cdf95ba4784fc7347bb353002f33516790d29e4b8ffa50fb77faee0532556f7c |
|
MD5 | f4188c0e4869ecaaea12f61def852d5d |
|
BLAKE2b-256 | 94b1b04333665be3db1410ddb04e72457be27f86ae2d1b0aded93db9e2421c2b |
Hashes for sente-0.1.4-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 257ff032868699cb75db0e74c893ecd104e47189e5e5350dc5874a493b1a7e49 |
|
MD5 | f161b92d9da1d4134db8fa9491e0491e |
|
BLAKE2b-256 | 7992cface6fa57438893e1cf2a943a4be9d792c5193cf0296dc0d60bd226612d |