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.
- 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
- 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
git clone https://github.com/emnet-4/XO-Game.git
cd XO_Gamecd backend
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
uvicorn main:app --reload --port 8001cd ../react-xo
npm install
npm run devOpen the URL shown in your terminal (usually http://localhost:5173) in your browser.
POST /new-game— Start/reset a gamePOST /move— Make a player movePOST /ai-move— Smart AI move (Minimax)POST /ai-move-random— Dumb AI move (random)
XO_Game/
backend/ # FastAPI backend (Python)
react-xo/ # React frontend (JavaScript)
- Edit
src/style.cssinreact-xofor UI tweaks - Edit
main.pyinbackendfor game logic
MIT