Skip to main content

A tic-tac-toe library that supports different sizes and dimensions and how many marks in a row to win

Project description

python-tictactoe

PyPI version Tests Build codecov

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)
  • 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.

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

python-tictactoe-0.0.5.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

python_tictactoe-0.0.5-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file python-tictactoe-0.0.5.tar.gz.

File metadata

  • Download URL: python-tictactoe-0.0.5.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using 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.2

File hashes

Hashes for python-tictactoe-0.0.5.tar.gz
Algorithm Hash digest
SHA256 6f5ab3fe6a58b897f36586e8261f579fc3f33e697b8ee6c75b07e4c64b7e4351
MD5 b544728bc1510ba4ff9bac500343097e
BLAKE2b-256 c9e81db90e8bc9fa9160f854f9ff1d5911650c1e2ab30c4b5a74f62ae2d5cdf8

See more details on using hashes here.

File details

Details for the file python_tictactoe-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: python_tictactoe-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using 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.2

File hashes

Hashes for python_tictactoe-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 58bf8b5baf88327aa0fdea21b1ea6a95c4fee244f1195d42c6150bf89fedb162
MD5 77030072c878b84017f035a40f591401
BLAKE2b-256 34b3527da48935991c3d5c31b66d2ce60e2fc053764c04dfc779f1bc3f5a347e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page