Exemplo n.º 1
0
        private bool candidatUnique(Case c)
        {
            bool action = false;

            foreach (char v in c.Hypotheses)
            {
                if (!lines.isHypothesePresent(c.Line, v) || !columns.isHypothesePresent(c.Column, v) ||
                    !squares.isHypothesePresent(c.Square, v))
                {
                    c.Valeur = v;
                    reportValue(c);
                    action = true;
                    break;
                }
            }
            return(action);
        }
Exemplo n.º 2
0
 private void addHypotheses()
 {
     for (int i = 0; i < sizeTable; i++)
     {
         for (int j = 0; j < sizeTable; j++)
         {
             if (grid[i, j].Valeur == '.')
             {
                 for (int k = 0; k < sizeTable; k++)
                 {
                     char v = Symbole[k];
                     if (lines.isNotPresent(grid[i, j].Line, v) && columns.isNotPresent(grid[i, j].Column, v) &&
                         squares.isNotPresent(grid[i, j].Square, v) && !grid.isHypothesePresent(i, j, v))
                     {
                         grid[i, j].addHypothese(v);
                     }
                 }
             }
         }
     }
 }