-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
29 lines (22 loc) · 699 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from tiktactoe import Tiktactoe
play = False
start = input("Would you like to play the Tiktactoe game? (y/n)")
if start.upper() == "Y":
play = True
game = Tiktactoe()
game.first_turn()
while play:
print(f"Player {game.current_player}'s turn")
game.print_board()
row, col = list(map(int, input("Enter row and column numbers to mark your spot: ").split()))
game.mark_spot(row,col)
if game.win():
print(f"{game.current_player} won.")
play = False
elif game.is_board_occupied():
play = False
print("the game is over - the result is a tie")
else:
game.switch_player()
print("the final result is:")
game.print_board()