Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from itertools import cycle
- def print_board(board):
- for ridx, row in enumerate(board, start=1):
- for cidx, col in enumerate(row, start=1):
- print(f"{col}{'|' if cidx in (1, 2) else ''}", end="")
- print(f"\n{LINE if ridx in (1, 2) else NULL}")
- LINE = "-|-|-"
- NULL = ""
- X = "X"
- O = "O"
- board = [[' ' for _ in range(3)] for _ in range(3)] # initialise
- moves = ((1, 1), (0,2), (2,1), (0,1), (0,0)) # testing
- players = cycle((X, O))
- print_board(board)
- for row,col in moves:
- board[row][col] =
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement