コード例 #1
0
ファイル: Cell.cs プロジェクト: hawk1996/sudoku-uni
 // Called from Puzzle constructor
 internal Cell(Puzzle owner, CellSet row, CellSet column, CellSet box)
 {
     Owner  = owner;
     Row    = row;
     Column = column;
     Box    = box;
 }
コード例 #2
0
ファイル: Puzzle.cs プロジェクト: hawk1996/sudoku-uni
 public Puzzle()
 {
     rows    = new CellSet[9];
     columns = new CellSet[9];
     boxes   = new CellSet[9];
     for (int i = 0; i < 9; i++)
     {
         rows[i]    = new CellSet(this, CellSetType.Row, i);
         columns[i] = new CellSet(this, CellSetType.Column, i);
         boxes[i]   = new CellSet(this, CellSetType.Box, i);
     }
     for (int ri = 0; ri < 9; ri++)
     {
         var row = rows[ri];
         for (int ci = 0; ci < 9; ci++)
         {
             var column = columns[ci];
             var box    = boxes[3 * (ri / 3) + ci / 3];
             var cell   = new Cell(this, row, column, box);
             row.Add(cell);
             column.Add(cell);
             box.Add(cell);
         }
     }
 }