A full-stack AI puzzle game where users can play the classic 8-puzzle and get hints powered by search algorithms (BFS, Best-First Search, A*). Built with Next.js (frontend) and Python FastAPI (backend).
| Service | URL |
|---|---|
| Frontend | puzzle-solver-uits-5b.vercel.app |
| Backend API | puzzle-solver-rjyx.onrender.com |
- 🎮 Interactive 8‑puzzle board — click tiles to move them
- 🤖 AI hint system — tells you how many moves to solve
- 🔍 Multiple algorithms — BFS, Best‑First Search, A*
- 📱 QR code sharing — share any puzzle with a friend by scanning
- ✅ Solvability checker — only generates solvable puzzles
- 🎉 Win detection — congratulates you when solved manually
Click the "How to play" button in the header to see a beautiful modal with full instructions. Here's a preview:
Quick rules:
- Move tiles adjacent to the empty space (click them).
- Arrange numbers from 1 to 8, with the empty tile at bottom-right.
- Press "Hint?" to get AI‑suggested minimum moves.
- Share any puzzle via the QR code on the right.
| Algorithm | Type | Description |
|---|---|---|
| BFS | Uninformed | Explores all nodes level by level. Guarantees shortest path. |
| Best‑First Search | Informed | Greedy — always picks the node closest to goal using Manhattan distance. |
| A* | Informed | Optimal — combines path cost and heuristic for best performance. |
- Next.js 15 — React framework
- Tailwind CSS — styling
- React Icons — icons
- React Toastify — notifications
- Farmer Motion — animation
- FastAPI — Python API framework
- Uvicorn — ASGI server
- qrcode — QR code generation
- Pillow — image processing
- Python 3.9+ (use
pycommand on Windows) - Node.js 18.17+
git clone https://github.com/ORNOB-083/AI-Lab-Project-Puzzle-Solver.git
cd AI-Lab-Project-Puzzle-Solvercd backend (using cmd)
py -m venv venv
venv\Scripts\activate # Windows
# source venv/bin/activate # Mac/LinuxThen
pip install -r requirements.txt
uvicorn main:app --reload --port 8000- Backend runs at: http://127.0.0.1:8000
- API docs: http://127.0.0.1:8000/docs
cd frontend
npm installCreate a .env.local file inside the frontend folder:
- text
NEXT_PUBLIC_API_URL=http://127.0.0.1:8000Then run:
npm run dev© 2026 team crazy4x Vibes. All rights reserved.
This project is licensed under the MIT License – see the LICENSE file for details.
