Study: Sudoku Solver

Logic
C#, Visual Basic
Patience to continue solving Sudoku puzzles by hand

About the project

Another personal project, my Sudoku solver was the result of a funny misunderstanding. Back in college we were choosing projects and the instructor, an Indonesian immigrant, suggested somebody should write a “Sudoku solver” game, as it would present a “unique but well defined challenge”. Well, as it turns out, what she meant was to create a game that would let the user play sudoku, which in retrospect would have been much easier. But that’s not what I made. What I made was a program that would allow one to enter a sudoku puzzle, from the Times or wherever, and push a button to solve it. It would work as a check for you answers. I have not solved a Sudoku puzzle by hand ever since because I can no longer solve them the “fun human deductive” way, and instead solve them basically by running my script by hand and much more slowly because I know it will work. Sudoku puzzles are now ruined.

Personal Project: The Death of Sudoku

This project was a wonderful experience with recursion and deeply nested looping logic. In short it goes through every square and calculates the “pencil marks” for each square then does some functions to determine if it can derive the final number for that square. Then it does this over and over iterating over each square for the entire puzzle having picked up new squares it now knows the answer to which in turn reveals more answered squares, then these same scripts are called recursively and the whole run through the puzzle starts over again only this loop with the newly solved squares which makes that pass through able to solve more squares.

My Task

I was interested in this personal project for the following reasons.

  • I used to love Sudoku puzzles.
  • I thought it would be a fun experiment with recursion and nested looping.
  • I haven’t refined it absolutely, but this method has to be among the faster methods for Sudoku solving and certainly would contain a minimum amount of source code.
  • For commercial application this script could be combined with a game that plays Sudoku to solve puzzles the user might enter from another source or “build on their own” in order to check if there is a valid solution for that user defined Sudoku puzzle.
July 2018
S M T W T F S
« Jun    
1234567
891011121314
15161718192021
22232425262728
293031  

26
Jun
2018

Leave a Reply

Your email address will not be published.
*