Sudoku Puzzle Generator
Article Options
- Article History
- RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Views
4,590
The macro generates Sudoku puzzles using a two-stage algorithm. Initially it finds a completed Sudoku square using a Markov chain algorithm that tries to sample at random from all squares that exist. The macro is not restricted to 9x9 squares and can generate squares up to 25x25 within a reasonable amount of time. In the field of experimental design, these squares are known as gerechte designs with rectangular regions. The second stage algorithm uses very simple reverse solving logic to generate a valid puzzle, by removing clues one by one from the completed square. The puzzle generated is written to a SAS data set in the work library and can also be viewed as listing output or as RTF/PDF files.