Skip to content

An Improved user interface was build for the TIC TAC TOE using pygame #2260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Create README.md
  • Loading branch information
BhanuSaketh authored Jun 30, 2024
commit d70116cec1d19c9df8b6b28f5b45ca2f8e4e1cad
39 changes: 39 additions & 0 deletions AI Game/Tic-Tac-Toe-AI/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# TIC TAC WITH AI

## Overview

TIC TAC WITH AI is a Python-based Tic Tac Toe game using the Pygame library. This project includes a basic implementation of the game with an AI opponent.The AI uses the minimax algorithm to make optimal moves, providing a challenging opponent for players.

## Features

- Single-player mode against an AI
- Minimax algorithm for AI decision-making
- Interactive graphical user interface using Pygame
- Restart functionality to play multiple games in one session
- Visual indicators for game outcome: win, lose, or draw



### Game Controls

- **Mouse Click:** Place your mark (X) on the board.
- **R Key:** Restart the game.

### Game Rules

- The game is played on a 3x3 grid.
- You are X, and the AI is O.
- Players take turns placing their marks in empty squares.
- The first player to get three of their marks in a row (horizontally, vertically, or diagonally) wins.
- If all nine squares are filled and neither player has three in a row, the game ends in a draw.

### Sample Interface

![image](https://github.com/BhanuSaketh/Python/assets/118091571/41a2823f-b901-485d-b53e-6ddd774dfd96)


## How It Works

- The game board is represented by a 3x3 numpy array.
- The game loop listens for user input and updates the game state accordingly.
- The AI uses the minimax algorithm to evaluate possible moves and choose the best one.