You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

Comp211 HW11  Supporting Code Details

Core Data Structures

 The main data structures are represented by 3 interfaces:

  • ICell --  a single square on the Sudoku board.  
    • A cell has a set of integer values, which are accessible either as a HashSet<Integer> or as an array of integers. 
    • A cell also has a collection (Vector<ICell>) of ICellSets to which it belongs.   These are the cell's row, column and block, in that order.
      • Don't forget that the cell is also a member of every ICellSet that it references.  
    • A cell can be in one of three logical states:
      • Empty - there are no values contained in the cell.   This corresponds to the situation where the board is unsolvable because a cell has no possible value.
      • Solved - the cell contains exactly one value.   If and only if you know for sure that the cell is in this state, then the single value can be accessed as aCell.getValueArray()[0].

      • Unsolved - the cell contains multiple possible values.   At most, a cell could contain order*order values.
  • ICellSet - A collection of ICells.  
    •  For convenience sake, the cells are in a distinct order (i.e. left-to right for a row) and thus each cell is addressable by an index value.
    •  


Utility Data Structures



Model-View-Controller Architecture



Puzzle Generation Utilities


  • No labels