Example #1
0
        List <int> errDomain = new List <int>();//keeps track of the coordinates of all the squares that are involved in the error.

        //ctor that takes an errtyp and a square, the errtype will help determine the errdomain and the square is used to find squares that are invloved in the error
        public Error(errType err, Square inc)
        {
            incon = inc.deepCopy();
            error = err;
            switch (error)
            {
            case errType.rowErr:
                for (int i = 0; i < 9; i++)
                {
                    int tempindex = incon.Y * 9 + i;
                    errDomain.Add(tempindex);
                }
                break;

            case errType.columnErr:
                for (int i = 0; i < 9; i++)
                {
                    int tempin = incon.X + (i * 9);
                    errDomain.Add(tempin);
                }
                break;

            case errType.squareErr:
                int temp = incon.SubCube;
                for (int i = 0; i < 9; i++)
                {
                    errDomain.Add(cubeCoords[temp, i]);
                }
                break;

            case errType.single:
                int index = incon.Y * 9 + incon.X;
                errDomain.Add(index);
                break;
            }
        }
Example #2
0
 //ctor that only copies the square from its argument
 public Error(Square inc)
 {
     incon = inc.deepCopy();
 }
Example #3
0
        //modifies the square that is at the same position as temp, creates a deepcopy of temp
        public void modBoard(Square temp)
        {
            int index = temp.Y * 9 + temp.X;

            board[index] = temp.deepCopy();
        }
Example #4
0
 //updates the square specified by the argument temp and updates the domain of all squares that temp constrains
 public void updateBoard(Square temp)
 {
     board[(temp.Y * 9) + temp.X] = temp.deepCopy();
     updatePossibles(temp);
 }