1 Sudoku Solver and Generator

Due: February 3

Implement a Sudoku (see Wikipedia) solver. Your solver should at least work on 3×3 boards (i.e., 81 cells), but ideally it should work on an arbitrary M×N boards.

Also, implement a Sudoku board generator. The generator should generate a random board—ideally any possible Sudoku board that has a unique solution, but that’s not really feasible, and an interesting part of the generator is finding a strategy to produce some board in a reasonable time.

For the solver and generator, no particular input or output is required.

For the general M×N case, M and N do not have to be unique. An example solved 1x2 board is

  1  2

  2  1

and an example solved 3x2 board is

  1 2 3  4 5 6

  4 5 6  1 2 3

  

  2 3 4  5 6 1

  5 6 1  2 3 4

  

  3 4 5  6 1 2

  6 1 2  3 4 5