python-ataxx is written in Python 3 and supports basic features such as move generation, move validation, engine communication, and board printing.
Project description
# python-ataxx: A Python library for the board game Ataxx
## About
python-ataxx is written in Python 3 and supports basic features such as move generation, move validation, engine communication, and board printing.
## Usage
```Python3
>>> import ataxx
>>> board = ataxx.Board()
>>> board.makemove(ataxx.parse_san("g2"))
>>> board.makemove(ataxx.parse_san("a7a5"))
>>> board.get_fen()
'6o/7/o6/7/7/6x/o5x x'
```
## Features
* Printing the board
```Python3
>>> board = ataxx.Board()
>>> print(board)
a b c d e f g
╔═╦═╦═╦═╦═╦═╦═╗
7║X║ ║ ║ ║ ║ ║O║7
╠═╬═╬═╬═╬═╬═╬═╣
6║ ║ ║ ║ ║ ║ ║ ║6
╠═╬═╬═╬═╬═╬═╬═╣
5║ ║ ║ ║ ║ ║ ║ ║5
╠═╬═╬═╬═╬═╬═╬═╣
4║ ║ ║ ║ ║ ║ ║ ║4
╠═╬═╬═╬═╬═╬═╬═╣
3║ ║ ║ ║ ║ ║ ║ ║3
╠═╬═╬═╬═╬═╬═╬═╣
2║ ║ ║ ║ ║ ║ ║ ║2
╠═╬═╬═╬═╬═╬═╬═╣
1║O║ ║ ║ ║ ║ ║X║1
╚═╩═╩═╩═╩═╩═╩═╝
a b c d e f g
Turn: X
```
* FEN parsing
```Python3
>>> board = ataxx.Board("startpos")
>>> board = ataxx.Board("x5o/7/2-1-2/7/2-1-2/7/o5x x")
```
* Result detection
```Python3
>>> board.gameover()
True
>>> board.fifty_move_draw()
False
>>> board.max_length_draw()
False
```
* Communication with UAI compatible engines
```Python3
>>> import ataxx.uai
>>> engine = ataxx.uai.Engine("tiktaxx")
>>> engine.uai()
>>> engine.isready()
>>> engine.name
'Tiktaxx'
>>> board = ataxx.Board()
>>> engine.position(board)
>>> bestmove, ponder = engine.go(movetime=1000)
>>> engine.go(movetime=1000)
('a7b5', None)
>>> engine.quit()
```
* Simple players
```Python3
>>> import ataxx.players
>>> board = ataxx.Board()
>>> ataxx.players.greedy(board)
<ataxx.Move object at 0x7f7747e28860>
```
## About
python-ataxx is written in Python 3 and supports basic features such as move generation, move validation, engine communication, and board printing.
## Usage
```Python3
>>> import ataxx
>>> board = ataxx.Board()
>>> board.makemove(ataxx.parse_san("g2"))
>>> board.makemove(ataxx.parse_san("a7a5"))
>>> board.get_fen()
'6o/7/o6/7/7/6x/o5x x'
```
## Features
* Printing the board
```Python3
>>> board = ataxx.Board()
>>> print(board)
a b c d e f g
╔═╦═╦═╦═╦═╦═╦═╗
7║X║ ║ ║ ║ ║ ║O║7
╠═╬═╬═╬═╬═╬═╬═╣
6║ ║ ║ ║ ║ ║ ║ ║6
╠═╬═╬═╬═╬═╬═╬═╣
5║ ║ ║ ║ ║ ║ ║ ║5
╠═╬═╬═╬═╬═╬═╬═╣
4║ ║ ║ ║ ║ ║ ║ ║4
╠═╬═╬═╬═╬═╬═╬═╣
3║ ║ ║ ║ ║ ║ ║ ║3
╠═╬═╬═╬═╬═╬═╬═╣
2║ ║ ║ ║ ║ ║ ║ ║2
╠═╬═╬═╬═╬═╬═╬═╣
1║O║ ║ ║ ║ ║ ║X║1
╚═╩═╩═╩═╩═╩═╩═╝
a b c d e f g
Turn: X
```
* FEN parsing
```Python3
>>> board = ataxx.Board("startpos")
>>> board = ataxx.Board("x5o/7/2-1-2/7/2-1-2/7/o5x x")
```
* Result detection
```Python3
>>> board.gameover()
True
>>> board.fifty_move_draw()
False
>>> board.max_length_draw()
False
```
* Communication with UAI compatible engines
```Python3
>>> import ataxx.uai
>>> engine = ataxx.uai.Engine("tiktaxx")
>>> engine.uai()
>>> engine.isready()
>>> engine.name
'Tiktaxx'
>>> board = ataxx.Board()
>>> engine.position(board)
>>> bestmove, ponder = engine.go(movetime=1000)
>>> engine.go(movetime=1000)
('a7b5', None)
>>> engine.quit()
```
* Simple players
```Python3
>>> import ataxx.players
>>> board = ataxx.Board()
>>> ataxx.players.greedy(board)
<ataxx.Move object at 0x7f7747e28860>
```
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
ataxx-1.0.tar.gz
(9.3 kB
view details)
Built Distribution
ataxx-1.0-py3-none-any.whl
(10.7 kB
view details)
File details
Details for the file ataxx-1.0.tar.gz
.
File metadata
- Download URL: ataxx-1.0.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86274e6e232b7ca78069124f3d578e7d1f55c8403e37f118ac3197dce30b19af |
|
MD5 | 0d2e58f7b90453f8c97265f7076c4ba6 |
|
BLAKE2b-256 | 152a8ecc14f40ef9f58ca756cc79a5f0c90f7a976c4bf2180ce09443d04cf0dd |
File details
Details for the file ataxx-1.0-py3-none-any.whl
.
File metadata
- Download URL: ataxx-1.0-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 081a1deb0a50e9396272dac1c8149301556aea8d5944a1a47e4e7da0fdff61c5 |
|
MD5 | 1ee4e2caf79d541ae8c754e218620361 |
|
BLAKE2b-256 | 74bc603355d62fe2c1464df0020fdd7ba59e2896c488149fc239abc47f6c814e |