Esempio n. 1
0
        public static LandTransition ReverseLandTransition(LandTransition landTransition)
        {
            int[,] matrix = LandTransitionHelper.GetMatrixFromLandTransition(landTransition);

            int[,] reverseMatrix = new int[, ]
            {
                { matrix[0, 0] == 1 ? 0 : 1, matrix[0, 1] == 1 ? 0 : 1 },
                { matrix[1, 0] == 1 ? 0 : 1, matrix[1, 1] == 1 ? 0 : 1 }
            };

            return(LandTransitionHelper.GetLandTransitionFromMatrix(reverseMatrix));
        }
Esempio n. 2
0
        public static LandTransition IntersectionLandTransition(LandTransition mainLandTransition, LandTransition secondLandTransition)
        {
            int[,] matrix1 = LandTransitionHelper.GetMatrixFromLandTransition(mainLandTransition);

            int[,] matrix2 = LandTransitionHelper.GetMatrixFromLandTransition(secondLandTransition);
            //if (secondLandTransition != LandTransition.NONE)
            //{
            //    matrix2 = LandTransitionHelper.GetMatrixFromLandTransition(secondLandTransition);
            //}
            //else
            //{
            //    matrix2 = FULL_MATRIX;
            //}

            int[,] intersectionMatrix = new int[, ]
            {
                { (matrix1[0, 0] == 1 && matrix1[0, 0] == matrix2[0, 0]) ? 1 : 0, (matrix1[0, 1] == 1 && matrix1[0, 1] == matrix2[0, 1]) ? 1 : 0 },
                { (matrix1[1, 0] == 1 && matrix1[1, 0] == matrix2[1, 0]) ? 1 : 0, (matrix1[1, 1] == 1 && matrix1[1, 1] == matrix2[1, 1]) ? 1 : 0 }
            };

            return(LandTransitionHelper.GetLandTransitionFromMatrix(intersectionMatrix));
        }