Skip to content

HelalOmar2001/Tic-Tac-Toe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Sure! Here's a simple readme for a Tic Tac Toe game:

Tic Tac Toe

This is a simple implementation of the classic Tic Tac Toe game in Python. It includes an AI agent that uses the minimax algorithm to play against the player.

Rules of the Game

Tic Tac Toe is a two-player game played on a 3x3 grid. The players take turns marking their symbol (usually "X" and "O") in empty cells. The first player to get three of their symbols in a row (horizontally, vertically, or diagonally) wins the game. If all cells are filled and no player has won, the game is considered a draw.

How to Play

  1. Run the file using a Python interpreter.
  2. The game will display an empty 3x3 grid.
  3. Each cell in the grid is represented by a number. Players take turns entering the number corresponding to the cell they want to mark.
  4. The game will validate the move and display the updated grid.
  5. The AI agent will automatically take its turn after the player's move.
  6. Continue taking turns until a player wins or the game ends in a draw.
  7. The game will display the result and will restart again.

AI Agent (Minimax Algorithm)

The AI agent in this game uses the minimax algorithm to make its moves. The minimax algorithm is a recursive algorithm that evaluates all possible moves and chooses the optimal one for the AI agent. It assumes that the opponent is also playing optimally and tries to minimize the maximum possible gain for the opponent.

Dependencies

This game requires Python 3.x & SimpleGUI2 library to run.

Enjoy playing Tic Tac Toe against the AI agent!

About

Tic Tac Toe game

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published