You’re writing the TicTacToe game. You need a function that determines if one side is winning given the state of the board. For example, given: 1 2 3 4 5 X | | O --------- | X | O --------- | | X The expected answer is: 1 winner: X
Example: preventing players from changing existing entries in tic tac toe game
# Checking whether the position on the tic tac board is occupied or not.
def place_marker(board, marker, position):
if board[position] == ' ':
board[position] = marker
else:
print("That space is already occupied.")