Tic-tac-toe is played on a three-by-three grid by two players, who alternately place the marks X and O in one of the nine spaces in the grid. The objective of the game is to get three of your symbols in a row, either horizontally, vertically, or diagonally, before your opponent does.
Here's a step-by-step guide on how to play Tic-Tac-Toe:
- The game begins with an empty 3x3 grid.
- Two players take turns, usually one playing as "X" and the other as "O."
- The first player places their symbol in an empty cell on the grid.
- The second player then places their symbol in a different empty cell.
- The players continue taking turns until one of the following conditions is met: 5.1. A player gets three of their symbols in a row (horizontally, vertically, or diagonally), resulting in a win. 5.2. All the cells on the grid are filled, resulting in a tie or draw.
- If a player gets three of their symbols in a row, they win the game. If all the cells are filled and no player has won, the game is a tie. To make a move, you need to specify the position on the grid where you want to place your symbol. This is usually done by using numbers 1 to 9 to represent the different cells on the grid, as shown in the given screenshots.
- Execute tictactoe.py file in any IDE.
- Press 1 to start the game.
- Now first player will choose the grid position to play a move with sign "X".
- Now second player will play his move and the game will move on as per the above rules.
- Priya Chaudhary
- Kaushal Diswar
- Ankit Kumar Singh
- Prachi Diswar