public static void FillSequential(SudokuBoard board) { board.SuppressChangeEvents(); board.Clear(); for (int row = 0; row < 9; row++) { for (int col = 0; col < 9; col++) { board[BoardMath.RowColToOrdinal(row, col)] = ((col + row) % 9) + 1; } } board.ResumeChangeEvents(); }
public static void FillStriped(SudokuBoard board) { board.SuppressChangeEvents(); board.Clear(); for (int row = 0; row < 9; row++) { int rowOffset = 3 * (row % 3) + row / 3; for (int col = 0; col < 9; col++) { board[BoardMath.RowColToOrdinal(row, col)] = ((col + rowOffset) % 9) + 1; } } board.ResumeChangeEvents(); }
public void GetPositionsForCoordinatesTest(int row, int column, int expectedPosition) { BoardMath.GetPositionForCoordinates(row, column).Should().Be(expectedPosition); }
public void GetCoordinatesForPositionTest(int position, int expectedRow, int expectedColumn) { BoardMath.GetCoordinatesForPosition(position).Item1.Should().Be(expectedRow); BoardMath.GetCoordinatesForPosition(position).Item2.Should().Be(expectedColumn); }
public void AreLegalCoordinatesTest(int row, int column, bool result) { BoardMath.AreLegalCoordinates(row, column).Should().Be(result); }