This is a simple Tic Tac Toe game implemented in Python. It allows two players to play against each other and keeps track of wins, losses, and draws.
-Two-player Tic Tac Toe game
-Tracks wins for X, O, and draws
-Option to rematch after each game
- Python 3.12.1
-To get started Clone the repository to a convenient location on your local machine.
You can run the following command on your terminal:
git clone https://github.com/koshambiB/TicTacToe.git-Run the command python main.py on your terminal.
-Follow the on-screen prompts to play the game.
-After a game, choose to rematch or exit.
The game uses a board represented by two lists (xval and oval), each containing 9 elements. A value of 9 indicates an empty space, while X or O represents a marked position. The checkWin function determines the winner based on the board state.
The code is organized into several functions:
Oturn: Handles O player's turn, taking input, validating it, and updating the board.
Xturn: Handles X player's turn, taking input, validating it, and updating the board.
game: Main game loop that manages turns, win conditions, draws, and restarts.
The game prompts players for their moves by asking for a position on the board (numbered 0-8). The game validates the input and updates the board accordingly. It checks for win conditions after each turn and declares a winner or draw if applicable. After a game, it asks the players if they want to rematch by entering Yes/No input. If the player chooses to exit, the game displays the number of matches each player won along with the number of draws.
I'm actively expanding the capabilities of this project by introducing exciting new features to enhance the functionality and user experience of this project.
These include:
Implementation of Multiple Game Modes: I am currently developing additional game modes to provide users with greater flexibility. This will allow players to choose between competing against AI or engaging in head-to-head competition with another player.
Dedicated Website Development: A dedicated website is under development. This website will further enhance the user experience.
This project is a work in progress, and I'm always open to valuable contributions.