MATLAB – Sudoku Solver Rev. 2.0

Update: I found another puzzle that breaks the code, click here for Revision 3.0!

I never claimed that my Sudoku Solver worked for every puzzle. In fact, it was pretty careless of me to post the code checking it against only two puzzles. And for those two puzzles, it worked just fine.

Two weekends ago, I went to Barnes and Noble, typed in one of the harder puzzles, and found out that my code broke. Oops. More »

MATLAB – Ignoring Plots in a Legend

Plotting in MATLAB can be interesting. Whichever you choose to plot first will end up at the back of the figure with all the plots that come after on top of it. Because of this, I like to put patch plots in the back (the red and blue between the black outline) and then plot the outlines after. The result is what you see above. More »

MATLAB – Sudoku Solver: solvedUpdate

Wow. So apparently my Sudoku Solver from my previous post got linked on someone’s Facebook. My tiny little blog normally gets 1-2 hits a day with spikes of about 15 or so. Yesterday, I apparently got 850 (!!) hits and today I’m at 217 and counting. Crazy thing, the internet.

So rather than sitting here in awe, mouth agape, I figure I’ll actually talk about my code some, as promised. More »

MATLAB – Sudoku Solver

Update: This was my first crack at this problem, and while it works for the two given puzzles, it breaks on other puzzles. Please see Revision 2.0 for an updated version of the code.

I went on travel last week; flew from the east coast to the west coast, non-stop. It’s a pretty long flight, about 5 hours. To amuse myself, I started doing the sudoku puzzle from the in-flight magazine. As I was finishing up the easy puzzle, I got this crazy idea to write up my own sudoku solver. “It can’t possibly be difficult, right?” I thought to myself. After all, solving a sudoku puzzle is just applied set theory; finding subsets and narrowing down the possibilities. More »