sudoku solver
My definition of human theory in this particular case, is avoiding the computational advantage computer have with brute force methods, with this in mind this solver only solves by elimination.
I started this project to try out DENOJS a JavaScript/TypeScript runtime made by the same guy that wrote NODEJS. If you haven't, you should definitely check it out!
Sudoku is an extremely popular game, played by millions of people all over the world. The rules are surprisingly simple the numbers 1 - 9
must appear exactly once in each : row, column and 3 x 3
square.
Like most puzzle that are easy to pick up this is also difficult to master. It requires intuition and intense problem solving skills.
It takes a STRING
as a input and first builds the puzzle from it. This string is exactly 81 characters long and thus can be easily checked before parsing.
After the puzzle has been verified the actual puzzle can be built. Afterwards we can iterate through the puzzle finding unsolved squares, Which through the process of elimination we can determine the possible values for each cell.
I purposefully avoided using a brute force solution as this would be fairly trivial to build with recursion algorithm. There is also already extremely well written articles on the subject.
It is always fascinating to try and put into code things that are so simple we do them without consciously imagining the steps to do them.
bottom