Background
Tic-Tac-Toe (also known as naughts and crosses) is a two-player game played on a 3x3 grid. The objective of the game is to be the first player to get three of their symbols in a row, either horizontally, vertically, or diagonally. The game is played by alternating turns, with each player placing their symbol (usually an X or an O) on an empty space on the board until one player achieves a winning configuration or the board is filled without a winner, resulting in a tie.
A Tic-Tac-Toe board can be represented in python by a 2-dimensional list, with each of the inner lists representing a row. Let’s look at an example: