public override bool Verify(int[] grid) { foreach (var c in AntiKnightConstraint.KnightsMoves(Cell, 9, 9, false)) { if (grid[c] == grid[Cell]) { return(false); } } return(true); }
public static IList <SvgConstraint> Generate(int[] sudoku) => Enumerable.Range(0, 81) .Where(cell => AntiKnightConstraint.KnightsMoves(cell, 9, 9, false).All(c => sudoku[c] != sudoku[cell])) .Select(cell => new AntiKnight(cell)) .ToArray();