The Sudoku game is to fill a 9×9 grid with numbers from 1 to 9, ensuring that each row, each column, and each of the nine 3×3 subgrids contain all the numbers from 1 to 9 without repetition.
Features:
- Game Layout:
- The game presents a 9×9 grid (Sudoku board) consisting of pre-filled numbers and empty cells.
- Players interact with the empty cells to fill in numbers based on Sudoku rules.
- Difficulty Levels:
- Easy: 35 clues (pre-filled numbers).
- Medium: 45 clues (pre-filled numbers).
- Hard: 55 clues (pre-filled numbers).
- Expert: 60 clues (pre-filled numbers).
- The difficulty level controls the number of given numbers (clues) and the overall complexity of the puzzle.
- Timer:
- The game features a timer that starts as soon as the player begins interacting with the puzzle.
- The timer counts the time taken to solve the puzzle in the format MM:SS (minutes:seconds).
- User Interaction:
- Players can fill in the empty cells with numbers from 1 to 9.
- Only valid numbers (1–9) are allowed; invalid entries are rejected and the user is prompted to enter a correct number.
- The game dynamically updates the board based on the player’s input.
- Buttons:
- Check Solution: Verify if the current board matches the correct solution. If the player has filled in the puzzle correctly, a success message is displayed; otherwise, an error message is shown.
- New Game: Starts a new puzzle with a new random grid, resetting the timer and clearing the board.
- Reset Game: Clears any numbers the player has filled in but keeps the original puzzle intact, allowing them to start over without changing the puzzle.
- Sudoku Puzzle Generation:
- The puzzle is generated using a backtracking algorithm, ensuring that each generated puzzle is solvable.
- Once a solvable puzzle is generated, numbers are removed randomly to create an empty puzzle for the player to solve.
- Mobile Responsiveness:
- The game layout adjusts to different screen sizes, making it accessible and functional on mobile devices, tablets, and desktops.
- Game Status:
- The game displays a status message that updates to show whether the player’s solution is correct or incorrect.
- When the puzzle is solved correctly, the player is congratulated and the time taken is displayed.
- If the player has not started or has made an incorrect solution, the status will prompt them to try again.
- Visual Design:
- The Sudoku board has distinct borders for the 3×3 subgrids, helping players easily identify the separate regions of the puzzle.
- The design is clean and minimalistic, using a modern aesthetic with rounded corners and subtle hover effects for buttons.
- The overall color scheme is light, with a gradient background and contrasting text and buttons to ensure readability.
- Timer Control:
- The timer begins when the game starts and continues running as long as the user interacts with the puzzle.
- The player is encouraged to complete the puzzle quickly, with the timer acting as a challenge.
How to Play:
- Choose Difficulty: Select your desired difficulty level (Easy, Medium, Hard, or Expert) from a dropdown menu.
- Fill the Grid: Enter numbers from 1 to 9 in the empty cells of the grid, ensuring that no number repeats in any row, column, or 3×3 subgrid.
- Check Solution: Once you’ve filled in the grid, click the “Check Solution” button to see if your solution is correct.
- Start New Game: If you wish to try another puzzle, click “New Game” to generate a new puzzle at your chosen difficulty level.
- Reset the Game: If you want to start over without generating a new puzzle, click “Reset Game” to clear your progress and try again.
Winning the Game:
- You win the game when all empty cells are filled correctly according to Sudoku rules (no repetition of numbers in rows, columns, or 3×3 subgrids).
- Upon winning, a congratulatory message will appear along with the time it took to solve the puzzle.