Skip to content

emnet-4/XO-Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

XO Game (Tic-Tac-Toe)

A modern XO (Tic-Tac-Toe) game with a Python FastAPI backend and a React frontend. Play against another player, a random (dumb) AI, or an unbeatable (smart) AI. Features a beautiful UI and dark mode toggle.

Features

  • Player vs Player, Player vs Computer (Dumb/Smart)
  • Unbeatable Minimax AI (Smart mode)
  • Random-move AI (Dumb mode)
  • Undo (PvP only)
  • Scoreboard
  • Dark mode toggle
  • Modern, responsive UI

How It Works

  • Frontend: React app for the user interface
  • Backend: FastAPI (Python) for all game logic and AI
  • The frontend communicates with the backend via HTTP API calls

Getting Started

1. Clone the repository

git clone https://github.com/emnet-4/XO-Game.git
cd XO_Game

2. Start the Backend

cd backend
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
uvicorn main:app --reload --port 8001

3. Start the Frontend

cd ../react-xo
npm install
npm run dev

4. Play the Game

Open the URL shown in your terminal (usually http://localhost:5173) in your browser.

API Endpoints

  • POST /new-game — Start/reset a game
  • POST /move — Make a player move
  • POST /ai-move — Smart AI move (Minimax)
  • POST /ai-move-random — Dumb AI move (random)

Project Structure

XO_Game/
  backend/         # FastAPI backend (Python)
  react-xo/        # React frontend (JavaScript)

Customization

  • Edit src/style.css in react-xo for UI tweaks
  • Edit main.py in backend for game logic

License

MIT

About

python and react tic-tak-toe Game

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published