Skip to content

Sumanth-NR/ZTicTacToe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZTicTacToe

Tic Tac Toe is a famous game in which two players take turns placing a mark on a 3x3 grid. The first player to get three in a row wins.

The module is a standalone implementation of the game TicTacToe providing functionality to keep track of the game's state and to make moves.

Features

  • Standalone implementation of the game Tic Tac Toe.
  • Provides a way to customise move triggers and access state variables.
  • Comes with an engine with near perfect moves.
  • Written in Python from scratch and does not require any external libraries.
  • Can be integrated into a larger project, with very little effort.
  • Throws custom-built errors making it easy to debug and handle errors.

Links

Installation

pip install zttt

Quick Start

Player vs Player

from zttt import PvP

game = PvP()
game.play(0)  # Player 1 plays top-left
game.play(4)  # Player 2 plays center
print(game.board)

Player vs Computer

from zttt import PvC

game = PvC(engine_first=False)  # Player goes first
game.play(4)  # Player plays center
print(game.board)  # AI has already responded

Development

Setup

Install development dependencies:

pip install -e ".[dev]"

Testing

Run tests:

pytest

Linting

Check code quality:

ruff check .

Format code:

ruff format .

License

MIT License - see LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages