A feature-rich, interactive Sudoku game built with vanilla HTML, CSS, and JavaScript. Play classic Sudoku puzzles with multiple difficulty levels, hints, and a built-in timer.
- Easy: 35 cells removed, includes error checking and real-time validation
- Medium: 45 cells removed (default)
- Hard: 55 cells removed
- Automatic timer that starts when you begin playing
- Displays elapsed time in MM:SS format
- Resets with each new game
- Toggle hints on/off to show possible valid numbers for empty cells
- Contextual feedback in Easy mode (correct/incorrect number validation)
- Hints automatically clear when you enter a number
- Keyboard Navigation: Use arrow keys to move between cells
- Number Input: Press 1-9 to enter numbers
- Clear Cells: Press Backspace, Delete, or 0 to clear
- Mouse Support: Click any cell to select it
- Check Solution: Validate your current progress
- Show Solution: Instantly reveal the complete solution
- New Game: Generate fresh puzzles anytime
- Open the Game: Open
sudoku.htmlin your web browser - Select Difficulty: Choose Easy, Medium, or Hard from the dropdown
- Fill the Grid: Click cells and enter numbers 1-9
- Use Hints: Click the "Hint" button to see possible numbers for empty cells
- Navigation: Use arrow keys or mouse to move between cells
- Check Progress: Use "Check Solution" to validate your current state
- Win: Complete the puzzle with all correct numbers!
Fill the 9×9 grid so that every row, column, and 3×3 box contains the digits 1-9 exactly once.
- Puzzle Generation: Uses recursive backtracking to create valid, solvable Sudoku puzzles
- Real-time Validation: Checks row, column, and 3×3 box constraints
- Smart Hint System: Calculates all possible valid numbers for any cell
- Adaptive Difficulty: Removes different numbers of cells based on selected difficulty
- Object-Oriented Design: Clean
SudokuGameclass with separated concerns - Event-Driven: Responsive keyboard and mouse interactions
- State Management: Maintains separate board, solution, and hint states
- Efficient Algorithms: Fisher-Yates shuffle for randomization, Set data structures for optimization
Works in all modern browsers with JavaScript enabled. No external dependencies required.
sudoku.html- Main game interface and structuresudoku.css- Styling and responsive layoutsudoku.js- Core game logic and algorithms
- Clone or download the project files
- Open
sudoku.htmlin any modern web browser - Start playing immediately - no installation required!
The game is easily customizable:
- Modify difficulty levels in the
newGame()method - Adjust styling in
sudoku.css - Add new features by extending the
SudokuGameclass
Enjoy playing Sudoku! 🧩