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); }
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")); }
public FleeMap GoRogueDualGoal() { // Flee map automatically updates when goal map does _dualGoalMap.Update(); return(_dualFleeMap); }
public FleeMap GoRogueSingleGoal() { // Flee map automatically updates when goal map does _singleGoalMap.Update(); return(_singleFleeMap); }
public GoalMap GoRogueDualGoal() { _dualGoalMap.Update(); return(_dualGoalMap); }
public GoalMap GoRogueSingleGoal() { _singleGoalMap.Update(); return(_singleGoalMap); }