Updated readme.

This commit is contained in:
retoor 2025-01-10 22:59:49 +01:00
parent 61dfaaaaef
commit c323ff5163
2 changed files with 88 additions and 61 deletions

View File

@ -1,66 +1,27 @@
# Sudoku # Sudoku Generator
## Sudoku solver This project is just a collection of research regarding the generation of sudoku's.
NOTE: not all puzzles in source are valid! It's not a production project.
## Sudoku generator The main focus is on the generation of sudoku's using several algorithms like backtracking.
## Applications
### Sudoku Generator
Just execute application and it will generate a sudoku for you with certain complexity.
### Sudoku Solvder
Give sudoku puzzle as input and it will solve it for you
### Sudoku Web
Run this server and it will run multiple sudoku generators and keeps track of many statistics while generating them.
### Screenshots
Will come when I figured out how to use this project again.
## How to use
I don't know. I have to figure out. It is a while ago that I wrote this.
This one is resolvable in 227 attempts:
```
{9, 0, 0, 0, 0, 0, 0, 0, 6},
{0, 8, 0, 0, 0, 0, 0, 5, 0},
{0, 0, 7, 0, 0, 0, 4, 0, 0},
{0, 0, 0, 6, 0, 3, 0, 0, 0},
{7, 6, 4, 0, 5, 0, 0, 0, 0},
{0, 0, 0, 1, 0, 4, 0, 0, 0},
{0, 1, 6, 0, 0, 0, 3, 0, 0},
{0, 7, 0, 0, 0, 0, 0, 2, 0},
{8, 0, 0, 0, 0, 0, 0, 0, 1}
```
// 227 attempts
```
{9, 0, 0, 0, 0, 0, 0, 0, 6},
{0, 8, 0, 0, 0, 0, 0, 5, 0},
{0, 0, 7, 0, 0, 0, 4, 0, 0},
{0, 0, 0, 6, 0, 3, 0, 0, 0},
{7, 6, 4, 0, 5, 0, 0, 0, 0},
{0, 0, 0, 1, 0, 4, 0, 0, 0},
{0, 1, 6, 0, 0, 0, 3, 0, 0},
{0, 7, 0, 0, 0, 0, 0, 2, 0},
{8, 3, 0, 0, 0, 0, 0, 0, 1}
```
// 320220 attempts
```
Generation: 18/18
155.34s
Solution: 220388352
7 2 1 3 4 5 6 8 9
4 6 8 1 9 7 2 5 3
3 9 5 2 8 6 1 7 4
2 5 3 4 6 9 7 1 8
1 7 6 8 2 3 4 9 5
9 8 4 5 7 1 3 2 6
6 3 9 7 5 2 8 4 1
5 4 7 6 1 8 9 3 2
8 1 2 9 3 4 5 6 7
```
// WRONG
int grid[N][N] = {
{9, 0, 0, 0, 0, 0, 0, 0, 6},
{0, 8, 0, 0, 0, 0, 0, 5, 0},
{0, 0, 7, 0, 0, 0, 4, 0, 0},
{0, 0, 0, 6, 0, 3, 0, 0, 0},
{0, 0, 0, 0, 5, 0, 0, 0, 0},
{0, 0, 0, 1, 0, 4, 0, 0, 0},
{0, 0, 6, 0, 0, 0, 3, 0, 0},
{0, 7, 0, 0, 0, 0, 0, 2, 0},
{8, 0, 0, 0, 0, 0, 0, 0, 2}
};
602.85s
Attempts:
1663211698
No solution exists

66
README2.md Normal file
View File

@ -0,0 +1,66 @@
# Sudoku
## Sudoku solver
NOTE: not all puzzles in source are valid!
## Sudoku generator
This one is resolvable in 227 attempts:
```
{9, 0, 0, 0, 0, 0, 0, 0, 6},
{0, 8, 0, 0, 0, 0, 0, 5, 0},
{0, 0, 7, 0, 0, 0, 4, 0, 0},
{0, 0, 0, 6, 0, 3, 0, 0, 0},
{7, 6, 4, 0, 5, 0, 0, 0, 0},
{0, 0, 0, 1, 0, 4, 0, 0, 0},
{0, 1, 6, 0, 0, 0, 3, 0, 0},
{0, 7, 0, 0, 0, 0, 0, 2, 0},
{8, 0, 0, 0, 0, 0, 0, 0, 1}
```
// 227 attempts
```
{9, 0, 0, 0, 0, 0, 0, 0, 6},
{0, 8, 0, 0, 0, 0, 0, 5, 0},
{0, 0, 7, 0, 0, 0, 4, 0, 0},
{0, 0, 0, 6, 0, 3, 0, 0, 0},
{7, 6, 4, 0, 5, 0, 0, 0, 0},
{0, 0, 0, 1, 0, 4, 0, 0, 0},
{0, 1, 6, 0, 0, 0, 3, 0, 0},
{0, 7, 0, 0, 0, 0, 0, 2, 0},
{8, 3, 0, 0, 0, 0, 0, 0, 1}
```
// 320220 attempts
```
Generation: 18/18
155.34s
Solution: 220388352
7 2 1 3 4 5 6 8 9
4 6 8 1 9 7 2 5 3
3 9 5 2 8 6 1 7 4
2 5 3 4 6 9 7 1 8
1 7 6 8 2 3 4 9 5
9 8 4 5 7 1 3 2 6
6 3 9 7 5 2 8 4 1
5 4 7 6 1 8 9 3 2
8 1 2 9 3 4 5 6 7
```
// WRONG
int grid[N][N] = {
{9, 0, 0, 0, 0, 0, 0, 0, 6},
{0, 8, 0, 0, 0, 0, 0, 5, 0},
{0, 0, 7, 0, 0, 0, 4, 0, 0},
{0, 0, 0, 6, 0, 3, 0, 0, 0},
{0, 0, 0, 0, 5, 0, 0, 0, 0},
{0, 0, 0, 1, 0, 4, 0, 0, 0},
{0, 0, 6, 0, 0, 0, 3, 0, 0},
{0, 7, 0, 0, 0, 0, 0, 2, 0},
{8, 0, 0, 0, 0, 0, 0, 0, 2}
};
602.85s
Attempts:
1663211698
No solution exists