-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
31 lines (28 loc) · 983 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
from game import *
from player import *
def main():
winner = False
players = []
wantinput = True
print("Beginning Tic Tac Toe 2.0\n**********************\n")
while (wantinput):
name = str(input("Enter player Name\n"))
icon = str(input("Enter player Icon\n"))
wantinput = str(input("Add Player? (y/n)\n")) == "y"
players.append(Player(name, icon))
width = int(input("Enter board width\n"))
height = int(input("Enter board height\n"))
game = XO(width,height)
while(not winner):
for player in players:
row = int(input("%s Enter Column to hit!\n"%player.name))
game.hit(row, player.icon)
print(game.print_board())
if game.check_win():
print("%s has Won!!!"%player.name)
winner = True
if str(input("Play again?(y/n)")) == "y":
main()
break
if __name__ == '__main__':
main()