We've used sample applications to drive our work. For this sprint we chose an existing perl script with a colorful history: the sudoku servant. See Sudokant
In order to compare implementations we follow the same general structure of the original perl.
Input. We retrieve the current board configuration from the query portion of the url. The 81 board positions are represented by digits when known (givens) and dot when yet to be determined (choices).
Subsets. The rules specify that specific nine element subsets must be filled with digits without duplication. We enumerate the indices of all subsets first by row, then column and square. We can check these in any order so we run them all together.
Rules. We eliminate choices no longer available in a subset based on the board state, the givens from input. We have two versions: at-most-one of every digit and at-least-one of every digit.
for every subset for every index in the subset remove or otherwise mark unavailable choices
Tables. We construct the visual frame for our output as a nested 3x3 square of 3x3 squares, each an "X" that we will soon replace. It is not a coincidence that these markers will appear in the html in the same order as we have numbered the givens and choices.
Choices. We now assemble everything we have learned into html for each place on the board. If the place is a given digit, we show that in a large font. Otherwise we do a little more case analysis to assemble up the desired display.
Output. We finish up by displaying the html version of the board just constructed along with some explanation and credits.
The most difficult puzzles of all are the ones that require a very wide range of the most challenging techniques – and for these the difficulty of the techniques far outweighs the number of cells to fill in. site