Professional Documents
Culture Documents
I used this as an excuse to learn Python. Going through examples is one way to learn but
doing a project is even better. My grandpa always sits around solving Sudoku which bleed into
his grandkids. I grew up solving these puzzles and when it came to learning Python, making an
automatic solver seemed like the obvious choice. When I am finished it, I had to show my
grandpa and race hit in solving a puzzle. Needless to say, even with his years of experience and
tricks that I do not know about, my program was able to beat him. The first thing that I had to
accomplish is what to do with the blank spaces. My solution was making those equal to 0.
Now that I had the base, it was time to solve. I recursively solved the system. Starting at
the top left if the value was a 0, it then added a 1 to that location.
Once it added the one, it would check to see if the one violated the rules of Sudoku. If it
did, then it would increment by one.
Figure 4. Violation
Figure 5. increase
If it passed, then it would move to the right following the same column but to the next
row. It would then repeat the process of starting at one, and counting up to 9.
Figure 5. increase
Figure 5. increase
If no value would work inside of that square, it would then go back one and increment
that by one.