-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
35 lines (31 loc) · 1009 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
29
30
31
32
33
34
35
#! /usr/bin/python3
from modules.boardPrint import printPrep as printBoard, boardSetup
from modules.player import *
from modules.game import *
icons, board = boardSetup()
def main(player1, player2):
while True:
for player in [player1, player2]:
printBoard(board)
if player.name[0:8] == 'Computer':
computer(player, board, icons)
else:
playermove(player, board, icons)
winner = isWinner(player, board, icons)
if winner:
printBoard(board)
break
if len(availableMoves(board, icons)) == 0:
printBoard(board)
print('Tie Game!!')
winner = True
break
if winner:
if playAgain():
if samePlayers():
main(player1, player2)
else:
setupGame()
break
player1, player2 = setupGame()
main(player1, player2)