A fully functional, interactive Sudoku game built with React + Vite and deployed via Vercel.
Includes smart features like cell highlighting, input validation, undo, hints, and a victory animation!
π Play it live here!
- β Sudoku board with random puzzle generation
- π― Real-time input validation (shows wrong numbers)
- π― Multiple difficulty levels
- π Undo feature
- π‘ Hint system
- π¨ Highlight matching numbers
- π§ Victory detection and animation
- π± Responsive design β works on mobile too!
This game includes a fully custom-built Sudoku puzzle engine that guarantees validity and uniqueness for each board.
-
Solved Board Generation
- A full Sudoku board is filled using a backtracking algorithm.
- The board is randomized but legal, forming a valid solution.
-
Deep Copy
- Before removing values, the solution board is deeply copied to preserve the final answer for:
- Hint logic
- Final victory validation
- Before removing values, the solution board is deeply copied to preserve the final answer for:
-
Clue Removal With Uniqueness Guarantee
- A list of all cell positions is generated and shuffled.
- For each cell:
- Temporarily remove its value.
- Count total solutions using a solution-counter function.
- Solution-counter function counts total number of possible solutions of a puzzle.
- Only remove it permanently if the board still has exactly one solution.
-
Difficulty Control
- The engine removes clues based on desired difficulty:
- Easy: ~35β40 clues
- Medium: ~28β34 clues
- Hard: ~22β27 clues
- However, the engine may stop early if further removals break uniqueness β preserving solvability.
- The engine removes clues based on desired difficulty:
- Every puzzle has exactly one valid solution
- Clue removal is optimized to make the board as challenging as possible without ambiguity
Clone and run locally:
git clone https://github.com/u-cant-see-me/Sudoku.git
cd Sudoku
npm install
npm run devMade with β€οΈ by Yash Gupta
Thanks to the many online Sudoku tools and tutorials that inspired the logic design.
Design, highlighting interactions, and several UI features were inspired by sudoku.com.
All logic β including board generation, uniqueness validation, hint systems, and animations β was implemented entirely from scratch.