Back in May 2020 when the pandemic lockdown was in full effect and we were spending our time fixing things around the house and generally cleaning up, we came across a bunch of Sudoku books that we had bought our children when they were young. When I opened them, I was surprised to see that at least a few of the puzzles had been started, but none were completed, with at least a hundred still left blank - we were probably too ambitious as parents when we gave them the books as they were probably too young. My first thought was to recycle the books, but that seemed like a shame as people who put the books together probably spent quite a bit of effort on them. So instead, my wife and I each took a few books and started solving the puzzles.
At first, things were going well, as most puzzles seemed quite easy to solve, but that did not last long. By the time I reached puzzle 80, the puzzles were becoming quite hard to solve without guessing - but guessing seemed like a cheat. For some reason I was under the belief that you should be able to solve these puzzles without any need for guessing, yet no matter how hard I tried, I could not solve some of them. And this is where the quest started to figure out how to solve really hard Sudoku puzzles without guessing.
The journey took me to many Sudoku sites like sudokuwiki.org, which describes 38 strategies to solve Sudoku puzzles and learn-sudoku.com which outlines simple and advanced techniques. But what I really wanted was to learn how to solve these puzzles I had, but with assistance when I got stuck. Although there are sites that will solve the puzzles for you, they do not enable you to learn at your own pace, the way I wanted to.
And that’s when I had the idea of building an app that implements a lot of the advanced Sudoku solving techniques that humans could use and then provides progressive hints to help you get better at seeing the patterns yourself. After playing several Sudoku apps, I decided on a 4-step hint process, which allows you to get just minimal help at first, but then gives you more hints, all the way to performing the step for you.
When I started working on this app I thought it would take me no more than a month to complete it, as the game seemed really simple, but things turned out to be quite differently. As I got further into it, it became clear that Sudoku is a very complex game that only appears to be easy because of it's surprisingly simple rules. The game took more than 6 months to develop and there is still more that I'd like to do..
While developing the solvers and building the puzzle user interface, I noticed that a simple improvement to the puzzle board visualization could significantly speed up the solving of the puzzles during the early stages. So I implemented a grid visualization button which selects between different modes of cells highlighting, when a cell is selected that has a value in it. The 4 modes implemented are:
To make this feature even more useful, I added a Setting called Tap to Lock, which changes the user interface dynamic so that tapping a digit on they keypad will lock it. This then highlights on the board all the possible cells where the locked digit can be placed on the board. Also, while the keypad digit is locked, taping on a board cell which does not contain a given digit, will place the value of the locked digit into that cell. This significantly speeds up solving boards or putting in pencil marks. The pencil ON/OFF button toggles the type of value that is placed in the cell - either a digit or a pencil mark/possible value. If you tap on the locked digit on the keypad again, it will remove the lock. Now selecting an empty cell will pop up a keypad menu next to the cell that allows you to quickly enter any value.
There are many other features I built to make the solving of the puzzles fun and less frustrating, like showing pencil marks as a grid or as a list of digits, automatically removing pencil marks when entering a digit, showing you when you make a mistake, full undo/redo capability and bookmarking.
For those really advanced users, I created a feature to allow you to generate puzzles of varying complexities including puzzles which are not solvable by the algorithms implemented in the app. With the twenty algorithms implemented in the app, I have found that it can solve over 92% of puzzles out there. This was based on solving over 50,000 puzzles that were either generated or found on the web. With future releases I hope to improve on that by implementing a few more algorithms, but only if they are practical for a human to do it.
Finally, to help me solve all the hard puzzles in the book, I implemented a feature to design your own puzzle, by entering the values of a puzzle yourself. This screen will validate the puzzle to ensure it’s solvable and will even tell you the complexity of the puzzle once you start it. In a future release I hope to improve this feature substantially by allowing you to take a picture of a puzzle and automatically import it into the game to solve.
I hope you give the game and try and have as much fun with it as I've had building it. Happy puzzle solving!