Tic Tac Toe, also known as Xs and Os, is a classic two-player game where players take turns marking spaces on a 3×3 grid. The goal is to align three of their marks (either "X" or "O") in a row, column, or diagonal before the opponent. If all spaces are filled without a winner, the game ends in a tie.
This Python-based Tic Tac Toe game allows two players to play in the terminal. It features:
A simple command-line interface.
A turn-based system alternating between "X" and "O".
Input validation to prevent invalid moves.
A win-checking mechanism for rows, columns, and diagonals.
Tic Tac Toe is a classic two-player game where players take turns marking "X" or "O" on a 3×3 grid. The first player to align three marks in a row, column, or diagonal wins. If all spaces are filled without a winner, the game ends in a tie.
However, This is a simple Python implementation of Tic Tac Toe, playable in the terminal.
- 🏆 Two-player mode (alternating turns for "X" and "O").
- ✅ Input validation to prevent invalid moves.
- 🏅 Automatic win detection.
- 🔁 Continuous play until a winner is found or the game is tied.
- Run the script using Python.
- Players take turns entering the row and column number (1-based index).
- The game board updates after each move.
- The game ends when a player wins or when all spaces are filled.
Clone this repository and run the script.
git clone https://github.com/Mahnoor-Muhammad-Naeem/Xs-and-Os.git
cd Xs-and-Os
python game.py
Start the game.
Enter the row and column number to place your mark.
Continue until a winner is declared or the game is tied.
O | X | X
The winner was X
📂 Xs-and-Os
├── game.py # Main game logic
├── README.md # Project documentation
This project is open-source and available under the MIT License.
This README provides a structured explanation for GitHub. Let me know if you need modifications! 🚀