The program employs an algorithm that mimics the penciling strategy used to solve Sudoku puzzles in real life, allowing it to solve any Sudoku board. While this approach is quite effective, it wasn't my original idea.
Initially, I tried solving Sudoku using a basic backtracking strategy with simple while loops. After testing it on various input boards, I quickly realized that my algorithm was inefficient, with some basic puzzles taking minutes, or even hours, to solve.
I decided to revisit the algorithm, still sticking with the backtracking approach but this time utilizing recursion. Although it was faster than my original attempt, some boards still took several minutes to solve.
After more research, I stumbled upon an advanced algorithm called Dancing Links, developed by Professor Donald Knuth. This algorithm can solve any Sudoku board with lightning speed, while also detecting unsolvable boards and identifying multiple solutions when present. A Sudoku solver using this powerful algorithm can be found on this website, and its main logic file is available here.
However, implementing the Dancing Links algorithm on my own proved to be quite challenging. I spent many hours trying to grasp its concepts by reading Professor Knuth’s book The Art of Computer Programming (Fascicle 5: Mathematical Preliminaries Redux; Introduction to Backtracking; Dancing Links), but due to time constraints, I couldn't fully comprehend it.
Eventually, I discovered a more accessible algorithm, which I mentioned at the start, from a LeetCode user named "Ov8CfeJ3Su." Their algorithm is much easier to understand and implement. You can find it here. The core logic of my program is based on their work, while the rest of the implementation was done by me.