Sudoku: Difference between revisions

Content added Content deleted
Line 1,839: Line 1,839:
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static int RowCol(int rc) => rc <= 2 ? 0 : rc <= 5 ? 3 : 6;
private static int RowCol(int rc) => rc <= 2 ? 0 : rc <= 5 ? 3 : 6;
private static IEnumerable<int> GetBox(int[][] grid, int row, int col) =>
private static IEnumerable<int> GetBox(this int[][] grid, int row, int col) =>
from r in Range(RowCol(row), 3)
from r in Range(RowCol(row), 3)
from c in Range(RowCol(col), 3)
from c in Range(RowCol(col), 3)
Line 1,866: Line 1,866:
grid[row]
grid[row]
.Union(domain.Select(r => grid[r][col]))
.Union(domain.Select(r => grid[r][col]))
.Union(GetBox(grid, row, col))
.Union(grid.GetBox(row, col))
.Except(Unmarked);
.Except(Unmarked);