Class: Xudoku::Generator
- Inherits:
-
Object
- Object
- Xudoku::Generator
- Defined in:
- lib/xudoku/generator.rb
Overview
Generates a new Sudoku puzzle by progressively removing clues from a solved board.
Starts by solving a blank board to obtain a complete solution, then repeatedly removes digits at random, keeping only removals that leave the puzzle uniquely solvable. The process continues until no further digits can be removed without introducing multiple solutions.
Constant Summary collapse
- SOLVE_ATTEMPTS =
5
Instance Method Summary collapse
-
#generate ⇒ Result
Generates a new Sudoku puzzle by solving an empty board and removing clues.