Пример #1
0
 public override bool Verify(int[] grid)
 {
     foreach (var c in NoConsecutiveConstraint.AdjacentCells(Cell, 9, 9, false))
     {
         if (grid[c] == grid[Cell])
         {
             return(false);
         }
     }
     return(true);
 }
Пример #2
0
 public static IList <SvgConstraint> Generate(int[] sudoku) => Enumerable.Range(0, 81)
 .Where(cell => NoConsecutiveConstraint.AdjacentCells(cell, 9, 9, false).All(c => Math.Abs(sudoku[c] - sudoku[cell]) != 1))
 .Select(cell => new NoConsecutive(cell))
 .ToArray();