Esempio n. 1
0
        //modifies the err of this error object and sets the domain of the error based on the type of the error
        public void setError(errType err)
        {
            switch (error)
            {
            case errType.rowErr:    //inconsistency caused by square in same row as specified square
                for (int i = 0; i < 9; i++)
                {
                    int index = incon.Y * 9 + i;
                    errDomain.Add(index);
                }
                break;

            case errType.columnErr:    //inconsistency caused by square in same column as specified square
                for (int i = 0; i < 9; i++)
                {
                    int index = incon.X + (i * 9);
                    errDomain.Add(index);
                }
                break;

            case errType.squareErr:    //inconsistency caused by square in same subCube as specified square
                int temp = incon.SubCube;
                for (int i = 0; i < 9; i++)
                {
                    errDomain.Add(cubeCoords[temp, i]);
                }
                break;

            case errType.single:    //inconsistency caused by future incident
                int tindex = incon.Y * 9 + incon.X;
                errDomain.Add(tindex);
                break;
            }//end switch
        }
Esempio n. 2
0
        public static void Log(errType et)
        {
            switch (et)
            {
            case errType.ThanhCong:
                Console.WriteLine("Thanh cong");
                break;

            case errType.ThatBai:
                Console.WriteLine("that bai");
                break;

            case errType.DanhSachTrong:
                Console.WriteLine("danh sach trong");
                break;

            case errType.DaTonTai:
                Console.WriteLine("da ton tai");
                break;

            case errType.KhongTonTai:
                Console.WriteLine("khong ton tai");
                break;

            case errType.KhongCoNhanVien:
                Console.WriteLine("nhan vien khong ton tai");
                break;

            case errType.KhongCoDuAn:
                Console.WriteLine("du an khong ton tai");
                break;
            }
        }
Esempio n. 3
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;
            }
        }