Skip to content

yash0g-dev/Sudoku

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

20 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧩 Sudoku Game

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!


✨ Features

  • βœ… 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!

🧠 How Puzzle Generation Works

This game includes a fully custom-built Sudoku puzzle engine that guarantees validity and uniqueness for each board.

Step-by-Step:

  1. Solved Board Generation

    • A full Sudoku board is filled using a backtracking algorithm.
    • The board is randomized but legal, forming a valid solution.
  2. Deep Copy

    • Before removing values, the solution board is deeply copied to preserve the final answer for:
      • Hint logic
      • Final victory validation
  3. 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.
  4. 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.

βœ… Guarantees

  • Every puzzle has exactly one valid solution
  • Clue removal is optimized to make the board as challenging as possible without ambiguity

πŸ› οΈ Tech Stack

  • React
  • Vite
  • Vercel
  • Custom JS game logic (Sudoku engine, backtracking solver, validation, UI state)

πŸš€ Getting Started

Clone and run locally:

git clone https://github.com/u-cant-see-me/Sudoku.git
cd Sudoku
npm install
npm run dev

πŸ™Œ Acknowledgements

Made 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.

About

🧩 Sudoku Game – React Based A fully-featured Sudoku game built with React that delivers a smooth, interactive puzzle-solving experience. The game supports rich logic features, user feedback, and helpful tools to improve gameplay and engagement.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages