A small package that provide the backend for tictactoe
Project description
tictactoe-abhay
Installation
pip install tictactoe-abhay
Example
from tic_tac_toe.TicTacToe import TicTacToe
game = TicTacToe("player 1", "player 2")
game.play_turn(5)
print(game.get_board())
>>>|1|2|3|
-------
|4|x|6|
-------
|7|8|9|
Methods and Attributes
Attributes
player_1:str name of player 1 (Default "player_1")
player_2:str name of player 2 (Default "player_2")
winner:str name of player if winner (Default "")
player_1_turn:bool priorty bit to keep track of player order(Init true)
board:list stores the state of the board
Methods
get_winner()
get the name of the winner
get_board()
return a str state of the board
play_turn(spot:int)
updates the board based on the spot and return status
status(int):
+1 : game has ended
+0 : successful in placing the spot
-1 : filled spot was selected
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
tictactoe-abhay-0.0.6.tar.gz
(3.0 kB
view hashes)
Built Distribution
Close
Hashes for tictactoe_abhay-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2bb1d32b80772b72a7fb5ce1ec5b09efa0df522ab7fcae1d279510f50d415d5d |
|
MD5 | fa6ae657a2c711147fa65003556d76da |
|
BLAKE2b-256 | b68eaa9fbf034592d15bfb2cc02dfdf79f22d54cb8e68b28a434d2ad65e71415 |