Solving Sudoku using C#

I wrote an article titled “Solving Sudoku Puzzles Using the MSF Library” in the August 2014 issue of MSDN Magazine. See The MSF (Microsoft Solver Foundation) library is a collection of code that can solve several different types of problems, including constraint satisfaction problems (CSPs).

A Sudoku puzzle is a CSP because the constraints are 1.) the numbers in each row must all be different (1 through 9), 2.) the numbers in each column must all be different, and 3.) the numbers in each of the nine 3×3 sub-cubes must all be different. And of course the starting numbers that define the puzzle are constraints too.


Another way of thinking about Sudoku puzzles is that they are combinatorial optimization problems where the goal is to minimize the number of constraint violations.

Anyway, it was a fun little exercise and I learned how to use the MSF library. Sadly, MSF has been discontinued — it just never gained any traction in the developer community. I’m not sure why, but the failure of MSF could be a case where good technology just didn’t get publicized properly, or maybe the documentation was not helpful enough. Not sure.

This entry was posted in Machine Learning. Bookmark the permalink.