How I Solved Sudoku With a Business Rules Engine
"I set myself the challenge of using the optimized inference engine, along with a few other advanced features, of a decision rules management solution to solve Sudoku puzzles." Read the full post on how it was accomplished.
By Fernando Donati Jorge
On a family trip a few months back, I was flipping through an airline magazine and landed on the puzzles page. There were three puzzles, “Easy”, “Medium”, and “Hard”. At the top of the page a word that would become my obsession over the next couple of months: “Sudoku”.
I had heard about Sudoku puzzles, but I had never really considered trying one. I grabbed a pencil from one of the kids and started with the “Easy” puzzle. It took me quite some time (and I tore the paper in one spot after erasing too many times) but I eventually completed the puzzle. Feeling confident, I made my way to the “Medium” puzzle but couldn’t get it right before we arrived at our destination.
On the flight home, I eagerly grabbed the flight magazine and committed to not giving up until I conquered both the “Medium” and “Hard” puzzles. When we finally got home, I downloaded a Sudoku app on my phone. My free time hasn’t been the same. Whenever I need to relax and forget about the world, I play a game. Or two. Or twenty.
Over time, I began developing a few strategies to solving the puzzles. I discovered that each time I found a value for a cell I could then apply those same strategies to the cell with the newfound value. It was all about consistently enforcing the rules behind each strategy, whenever new values became available. It dawned on me that was exactly what inference engines were good at.
Now I happen to be the product manager for an amazing inference engine. I set myself the challenge of using the optimized inference engine, along with a few other advanced features, of a decision rules management solution to solve Sudoku puzzles.
To learn how I represented the puzzle, which rules I used, and how I used patterns to solve the “Easy” puzzle, read the full post: Sudoku Rules which is part one in a series on this topic.