예제 #1
0
 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();
 }
예제 #2
0
 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();
 }
예제 #3
0
 public void GetPositionsForCoordinatesTest(int row, int column, int expectedPosition)
 {
     BoardMath.GetPositionForCoordinates(row, column).Should().Be(expectedPosition);
 }
예제 #4
0
 public void GetCoordinatesForPositionTest(int position, int expectedRow, int expectedColumn)
 {
     BoardMath.GetCoordinatesForPosition(position).Item1.Should().Be(expectedRow);
     BoardMath.GetCoordinatesForPosition(position).Item2.Should().Be(expectedColumn);
 }
예제 #5
0
 public void AreLegalCoordinatesTest(int row, int column, bool result)
 {
     BoardMath.AreLegalCoordinates(row, column).Should().Be(result);
 }