示例#1
0
        public static TimeSpan TimeForGoalMap(IMapView <bool> map, IEnumerable <Coord> goals, int iterations)
        {
            Stopwatch s = new Stopwatch();

            var mapGoals   = createGoalStateMap(map, goals);
            var mapBuilder = new GoalMap(mapGoals, Distance.CHEBYSHEV);

            mapBuilder.Update();

            s.Start();
            for (int i = 0; i < iterations; i++)
            {
                mapBuilder.Update();
            }
            s.Stop();

            return(s.Elapsed);
        }
示例#2
0
        public void ManualGoalMapTest()
        {
            var map = new ArrayMap <bool>(MAP_WIDTH, MAP_HEIGHT);

            RectangleMapGenerator.Generate(map);

            var stateMap = new ArrayMap <GoalState>(map.Width, map.Height);

            foreach (var pos in stateMap.Positions())
            {
                stateMap[pos] = map[pos] ? GoalState.Clear : GoalState.Obstacle;
            }

            stateMap[MAP_WIDTH / 2, MAP_WIDTH / 2]          = GoalState.Goal;
            stateMap[MAP_WIDTH / 2 + 5, MAP_HEIGHT / 2 + 5] = GoalState.Goal;

            var goalMap = new GoalMap(stateMap, Distance.EUCLIDEAN);

            goalMap.Update();

            Assert.AreEqual(null, goalMap[0, 0]);

            Console.Write(goalMap.ToString(5, "0.00"));
        }
示例#3
0
 public FleeMap GoRogueDualGoal()
 {
     // Flee map automatically updates when goal map does
     _dualGoalMap.Update();
     return(_dualFleeMap);
 }
示例#4
0
 public FleeMap GoRogueSingleGoal()
 {
     // Flee map automatically updates when goal map does
     _singleGoalMap.Update();
     return(_singleFleeMap);
 }
示例#5
0
 public GoalMap GoRogueDualGoal()
 {
     _dualGoalMap.Update();
     return(_dualGoalMap);
 }
示例#6
0
 public GoalMap GoRogueSingleGoal()
 {
     _singleGoalMap.Update();
     return(_singleGoalMap);
 }