#Noughts and Crosses
win_combinations=[[0,1,2],[3,4,5],[6,7,8],[0,3,6],[1,4,7],[2,5,8],[0,4,8],[2,4,6]]
play_loc_list1=[]
play_loc_list2=[]
board=["1","2","3","4","5","6","7","8","9"]
print("*"*50)
print("Welcome to our Noughts and Crosses Game!")
print("*"*50)
player1=input("Enter the name of the first player: ")
player2=input("Enter the name of the second player: ")
no_win=True
turn=1
board=["1","2","3","4","5","6","7","8","9"]
def make_board():
print("Noughts and Crosses")
print(board[0],":",board[1],":",board[2])
print(".........")
print(board[3],":",board[4],":",board[5])
print(".........")
print(board[6],":",board[7],":",board[8])
make_board()
while no_win:
while turn==1 and no_win:
print("Hi",player1)
locx=int(input("Cross location(choose 1 - 9): "))
board[locx-1]="X"
loc_attempt=locx-1
play_loc_list1.append(loc_attempt)
play_loc_list1.sort()
for i in range (0,len(win_combinations)):
if win_combinations[i]==play_loc_list1:
print("You have won!")
no_win=False
make_board()
turn=2
while turn==2 and no_win:
print("Hi",player2)
locx=int(input("Noughts location(choose 1 - 9): "))
board[locx-1]="O"
loc_attempt=locx-1
play_loc_list2.append(loc_attempt)
play_loc_list2.sort()
for i in range (0,len(win_combinations)):
if win_combinations[i]==play_loc_list2:
print("You have won!")
no_win=False
make_board()
turn=1