Soldato
- Joined
- 22 Nov 2007
- Posts
- 4,204
Hey guys
I am writing code for a tic tac toe game as part of a udemy course i am doing. The problem is I can't get the following two functions to work properly. When the board is filled with X's or O's it works but if there are numbers in there it still returns True. The numbers are needed at the start so the player knows where they are putting X or O.
I am writing code for a tic tac toe game as part of a udemy course i am doing. The problem is I can't get the following two functions to work properly. When the board is filled with X's or O's it works but if there are numbers in there it still returns True. The numbers are needed at the start so the player knows where they are putting X or O.
Code:
def space_check(board, position):
# print(board[position]=="X" or board[position]=="O")
return board[position] != 'X' and board[position] != 'O'
def full_board(board):
for i in range(len(board)):
if space_check(board, i): print(i)
return False
print(i)
return True
test_board = ['X', '1', '3', '4', '5', "6", 'X', 'O', 'X', 'O']