public PredefinedSudokuBox(
     SudokuBoxCoordinate coordinate,
     SudokuBoxCoordinate?parentCoordinate,
     SudokuBoxNumbers number)
     : base(coordinate, parentCoordinate, SudokuBoxState.Predefined)
 {
     Number = number;
 }
Esempio n. 2
0
 public NoteSudokuBox(
     SudokuBoxCoordinate coordinate,
     SudokuBoxCoordinate parentCoordinate,
     IEnumerable <SudokuBoxNumbers> numbers)
     : base(coordinate, parentCoordinate, SudokuBoxState.Note)
 {
     Numbers = numbers;
 }
 public static SudokuBoxCoordinate GetCoordinate(int x, int y, SudokuBoxCoordinate maxCoordinate)
 {
     if (x < 1 || x > (int)maxCoordinate.X)
     {
         throw new ArgumentOutOfRangeException(nameof(x));
     }
     if (y < 1 || y > (int)maxCoordinate.Y)
     {
         throw new ArgumentOutOfRangeException(nameof(y));
     }
     return(new SudokuBoxCoordinate((SudokuBoxNumbers)x, (SudokuBoxNumbers)y));
 }
        public SudokuBoxCoordinate?GetNext(SudokuBoxCoordinate maxCoordinate)
        {
            var currentIndex = GetIndex(this, maxCoordinate.X);
            var maxIndex     = GetIndex(maxCoordinate, maxCoordinate.X);

            if (currentIndex >= maxIndex)
            {
                return(null);
            }

            return(GetCoordinate(currentIndex + 1, maxCoordinate.X));
        }
Esempio n. 5
0
 public UserFilledSudokuBox(SudokuBoxCoordinate coordinate, SudokuBoxCoordinate parentCoordinate, SudokuBoxNumbers?number)
     : base(coordinate, parentCoordinate, SudokuBoxState.UserFilled)
 {
     Number = number;
 }
Esempio n. 6
0
 protected SudokuBoxBase(SudokuBoxCoordinate coordinate, SudokuBoxCoordinate?parentCoordinate, SudokuBoxState state)
 {
     Coordinate       = coordinate;
     ParentCoordinate = parentCoordinate;
     State            = state;
 }
 public static int GetIndex(SudokuBoxCoordinate coordinate, SudokuBoxNumbers xWidth)
 {
     return(((int)coordinate.X - 1) * (int)xWidth + (int)coordinate.Y - 1);
 }