예제 #1
0
        public override void DestroyMaze(
            Random rand,
            PM_Maze maze
            )
        {
            Rect2i boundingRect    = maze.BoundingRect();
            Rect2i destructionRect = boundingRect.Random_ContainedRect(rand);

            maze.HOP_DeleteArea(destructionRect);
        }
        public static int ShortestDistance(this PM_Maze maze, Vec2i root, Vec2i destination)
        {
            if (maze.BoundingRect().Contains(root) == false)
            {
                throw new SystemException("root not contained in maze");
            }
            if (maze.BoundingRect().Contains(root) == false)
            {
                throw new SystemException("destination not contained in maze");
            }

            if (root == destination)
            {
                return(0);
            }

            List <Vec2i> shortestPath = maze.BFS_ShortestPath(root, destination);

            return(shortestPath.Count - 1);
        }
        public static void HOP_DeleteRandomArea(this PM_Maze maze, Random rand)
        {
            Rect2i randomArea = maze.BoundingRect().Random_ContainedRect(rand);

            maze.HOP_DeleteArea(randomArea);
        }