Today in class I made tic-tac-toe.

This is the code for the board:
board = ["-", "-", "-",
"-", "-", "-",
"-", "-", "-"]
This is the code for printing the game board:
def printBoard(board):
print(board[0] + " | " + board[1] + " | " + board[2])
print("----------")
print(board[3] + " | " + board[4] + " | " + board[5])
print("----------")
print(board[6] + " | " + board[7] + " | " + board[8])
This is the code for checking for wins:

This is the code for switching players:
def switchPlayer():
global currnetPlayer
if currnetPlayer == "X":
currnetPlayer = "O"
else:
currnetPlayer = "X"
No Responses