Exemplo n.º 1
0
 //Get the cells in a set in the sudoku that are not set final
 public void sets()
 {
     //Check Rows
     for (int row = 0; row < 9; row++)
     {
         List <Cell> list = new List <Cell>();
         for (int col = 0; col < 9; col++)
         {
             Cell tmp = cells[row, col];
             if (tmp.getvalue() == 0)
             {
                 list.Add(tmp);
             }
         }
         pos2(list);
     }
     //Check Columns
     for (int col = 0; col < 9; col++)
     {
         List <Cell> list = new List <Cell>();
         for (int row = 0; row < 9; row++)
         {
             Cell tmp = cells[row, col];
             if (tmp.getvalue() == 0)
             {
                 list.Add(tmp);
             }
         }
         pos2(list);
     }
     //Check Quadrants
     for (int initrow = 0; initrow < 3; initrow++)
     {
         for (int initcol = 0; initcol < 3; initcol++)
         {
             List <Cell> list = new List <Cell>();
             for (int row = 0; row < 3; row++)
             {
                 for (int col = 0; col < 3; col++)
                 {
                     Cell tmp = cells[initrow * 3 + row, initcol * 3 + col];
                     if (tmp.getvalue() == 0)
                     {
                         list.Add(tmp);
                     }
                 }
             }
             pos2(list);
         }
     }
 }