python-tictactoe
A tic-tac-toe library that supports different sizes and dimensions and how many marks in a row to win.
Installing
Download and install the latest release:
pip install python-tictactoe
Features
-
Includes mypy typings.
-
Different board sizes
from tictactoe import Board
board = Board(dimensions=(4, 5))
- More than 2 dimensions
from tictactoe import Board
board = Board(dimensions=(6, 2, 5, 8))
- More than 3 in a row to win
from tictactoe import Board
board = Board(dimensions=(10, 10, 10), x_in_a_row=8)
- See the board
from tictactoe import Board
board = Board(dimensions=(2, 2, 2), x_in_a_row=2)
board.push((0, 0, 0))
board.push((0, 1, 0))
print(board)
"""
X |
-------
O |
-------
-------
|
-------
|
"""
- Generate endgame tablebases
from tictactoe.egtb import Generator
import functools, operator
dimensions = (4, 3)
total_squares = functools.reduce(operator.mul, dimensions)
for index in reversed(range(total_squares + 1)):
Generator(dimensions, 3, index)
- Read endgame tablebases
from tictactoe.egtb import Reader
from tictactoe import Board
reader = Reader((3, 3), 3, 2)
board = Board((3, 3), 3)
board.push((0, 0))
board.push((0, 1))
print(reader.index(board))
License
python-tictactoe is licensed under the MIT License. Check out LICENSE for the full text.
Release files for python-tictactoe 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| python-tictactoe-0.0.7.tar.gz | 6.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| python_tictactoe-0.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.9 kB
Release files / python-tictactoe-0.0.7.tar.gz
| Download URL | python-tictactoe-0.0.7.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a2e9097b213f91b77388ad618f5c3a3867b533eb147d9a2c4f21395ddb2d4d1e
|
|
BLAKE2b-256 checksum How to use checksums |
70d0da2062a18f9d526f06dab5e2f7890521014011f3d6ab3acba7c1bacff262
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.13
|
Release files / python_tictactoe-0.0.7-py3-none-any.whl
| Download URL | python_tictactoe-0.0.7-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7430c78109fce78585044a3824924568029d8e5845e5bea136c282ff477de3ef
|
|
BLAKE2b-256 checksum How to use checksums |
e0e31944f4dcc21e9f9edad21b0ddaaa79af843597075fe243d1ddf9b405f16b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.13
|