Skip to content

linchsa/Sudoku-Generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 

Repository files navigation

Sudoku-Generator

Just a classic Sudoku generator that creates random sudoku's combinations

How does it work?

By implementing some checking functions (rows, columns and regions), the program generates the sudoku by regions. After some tests, I find out that the most efficient way of generating it was starting with region 5 (middle), then R4 and R6, etc. (the order is written in the code).

While it is generating the regions, the program checks if the random number combination is valid. If it is not, then it generates another one until is valid. To avoid infinite loops, I pinned up a limit of operations. If the limit is exceeded, it restarts the sudoku from the beggining.

Example

|4||7||3||6||2||8||5||9||1|

|8||2||5||1||9||7||3||6||4|

|6||1||9||3||5||4||7||8||2|

|2||5||4||8||3||9||1||7||6|

|1||6||8||4||7||5||2||3||9|

|9||3||7||2||6||1||8||4||5|

|5||4||2||7||8||6||9||1||3|

|3||8||6||9||1||2||4||5||7|

|7||9||1||5||4||3||6||2||8|

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages