Skip to content

Commit

Permalink
added screenshot and docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
Vivek Dagar committed Apr 5, 2024
1 parent bd17a74 commit f3a04d9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
Binary file added assets/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 0 additions & 5 deletions tictacai/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
from .statistics import Statistics


def abort():
print("\nGame aborted. Thanks for playing!")
exit()


def wins(state, player):
win_state = [
[state[0][0], state[0][1], state[0][2]],
Expand Down
15 changes: 15 additions & 0 deletions tictacai/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,43 @@

from .game import Game

"""
This script provides a command-line interface for playing Tic Tac Toe.
"""

@click.group()
def tictactoe():
"""
Command-line interface for playing Tic Tac Toe.
"""
pass


@tictactoe.command()
def human():
"""
Command to play Tic Tac Toe against another human player.
"""
game = Game()
game.symbols()
game.play_game('h')


@tictactoe.command()
def ai():
"""
Command to play Tic Tac Toe against an AI.
"""
game = Game()
game.symbols()
game.play_game('c')


@tictactoe.command()
def scores():
"""
Command to display game scores.
"""
Game().score_card.display_statistics()


Expand Down

0 comments on commit f3a04d9

Please sign in to comment.