Skip to content

AI Sudoku Solver

This an algorithm that solves the worlds hardest Sudoku puzzles (horizontally, vertically, and diagonally) very efficiently.

No matter what the puzzle looks like, the input data should be a string that contains numbers and dots (dots represent empty spots) that is 81 characters long. Which is a Sudoku puzzle grid flattened row by row.

A puzzle like this:

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

Should be transformed into something like this:

"9.1....8.8.5.7..4.2.4....6...7......5..............83.3..6......9................"

To use the algorithm:

# python interpretation

puzzle = {"data": "9.1....8.8.5.7..4.2.4....6...7......5..............83.3..6......9................"}
algo = c.algo('/adam/ai_sudoku/')
response = algo.pipe(puzzle)

Algorithm Output

response
>>> AlgoResponse(
    result = 961354287835276149274891365427138956583962714619547832342689571798415623156723498,
    metadata=Metadata(
        content_type='json',
        duration=3.4776217937469482,
        stdout=None
    )
)