retoor caac0f8341 feat: add initial project scaffolding with Makefile, C sources, web UI, and documentation
Add Makefile with build targets for sudoku solver, generator, and coverage reporting.
Include NOTES.md explaining sudoku difficulty factors and solving techniques.
Add README.md with puzzle examples and generator output.
Implement app.js with Grid and Grid2 classes for rendering puzzle data in the browser.
Add box.c with functions for box indexing, grid-to-array conversion, and box value extraction.
Include footer.h with terminal size detection, cursor positioning, and footer display utilities.
Add index.html with CSS grid layout and script loading for the web interface.
Include rlib.h as a large utility header library.
2025-01-10 21:53:10 +00:00

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

S
Description
Software for generating the hardest sudoku you can imagine. It's heavily multi threaded to achieve it. The number of valid Sudoku puzzles has been calculated to be 6,670,903,752,021,072,936,960 (approximately 6.67 × 10²¹).
Readme
1.5 MiB
Languages
C 90.8%
JavaScript 5.1%
HTML 4%
Makefile 0.1%