Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • An empty board is fully determined by a single value, it's "order", which for a 9x9 board is 3.
  • The board is viewable in terms of rows, columns and blocks.
    • Each row, column and block has exactly order2 cells, e.g. for order = 3, each row, column and block has 9 cells.
    • Each board has exactly order2 rows, columns and blocks.
  • Each cell is a member of exactly one row, one column and one block.
    • No rows share the same cell.   Likewise, no columns or blocks share cells.  This forces the square matrix layout  of rows, columns, and order^2 sub-matrix of blocks if one were to display the rows, columns and blocks where each cell is only shown once.
  • The rules of Sudoku stipluate that the value in any given cell has very specific constraints:
    • Wiki Markup
      The valid values are {{1...order{}}}^{{{}{^}2{^}}^} (inclusive), e.g. for order=2, the allowed values are \[1, 2, 3, 4\]
    •  Any valid value in a cell cannot appear in another cell in the row, column or block to which that cell belongs.   Conversely, each row, column or block must contain every valid value exactly once.

...

A "board" is therefore a set of three three {{Vector<ICellSet>}}s representing the rows, columns and blocks of the board.   Note that any given cell will appear once in the rows, once in the columns and once in the blocks.   The data structures that we have created enable us to access the cells in multiple methods that clearly represent the cell relationships in the manner that best models the problem at hand, namely the Sudoku board.   We can easily and consistently see the cells in terms of rows or columns or blocks in a manner that is abstractly equivalent, enabling us to easily reuse the same code to process the cells in any direction we choose.   Compare this to a standard NxN matrix representation (a collection of rows) which represents only a single cell relationship feature, namely that they are in rows.   Luckily, accessing the cells in terms of columns is not too difficult, but accessing them in terms of blocks is a bear!

...