Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 21 additions & 12 deletions tictactoe/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,49 @@

This project implements a simple game of Tic-Tac-Toe using the Pygame library. You can play against an AI opponent that makes optimal moves using the minimax algorithm.

## 📸 Preview

![Tic-Tac-Toe Screenshot](screenshot.png)

## Table of Contents
## 📑 Table of Contents

- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [How to Play](#how-to-play)
- [AI Opponent](#ai-opponent)


## Prerequisites
## Prerequisites

To run this project, you'll need the following:

- Python 3.x
- Pygame library (already included in the project)

## Installation
## 💾 Installation

1. Clone the repository to your local machine:

```bash
git clone https://github.com/your-username/tic-tac-toe-pygame.git

## How to Play
- use runner.py to open game
- When you run the game, you'll be presented with a menu to choose your player: "X" or "O". Click on the respective buttons to select.
- The game board will appear, and you can take turns to make your moves by clicking on an empty cell.
- The AI opponent (if you didn't choose it as your player) will also make moves using the minimax algorithm.
- The game will continue until there is a winner or a tie. The result will be displayed at the top of the game window.
- You can play again by clicking the "Play Again" button after the game ends.
## AI Opponent
- The AI opponent uses the minimax algorithm to make optimal moves. It considers all possible moves and selects the best one to maximize its chances of winning or minimizing the chances of losing. You can try to beat the AI in this classic game!
## 🎮 How to Play

1. use runner.py to open game
2. When the game starts, you'll see a menu to choose your player: X or O. Click the respective button to select
3. The game board will appear. Click on an empty cell to make your move.
4. The AI opponent (if you didn't select it as your player) will make moves using the Minimax algorithm.
5. The game will continue until there is a winner or a tie. The result will be displayed at the top of the game window.
6. Click the Play Again button to restart the game.

## 🤖 AI Opponent
The AI uses the Minimax algorithm to make optimal moves. It evaluates all possible game states to choose the best move, aiming to:

* Maximize its chances of winning

* Minimize the chances of losing

Try to beat the AI in this classic game of strategy!



Expand Down