public void Create_NewGrid4X4WithBlocked16_FindGreedyPath() { GridSearchNode initialState = _basicWorld4X416.GetInitialSearchNode <GridSearchNode>(); GreedyMax greedy = new GreedyMax(initialState, new GoalOnLocation(_basicWorld4X416.Goal)); Assert.IsNotNull(greedy); greedy.Run(Int32.MaxValue); var maxGoal = greedy.GetMaxGoal(); Assert.AreEqual(10, maxGoal.g); }
public void Create_NewGrid3X3_findGreedyPath() { GridSearchNode initialState = _basicWorld3X3.GetInitialSearchNode <GridSearchNode>(); GreedyMax greedy = new GreedyMax(initialState, new GoalOnLocation(_basicWorld3X3.Goal)); Assert.IsNotNull(greedy); greedy.Run(Int32.MaxValue); //Prevent stoping by time, should stop only when goal found var maxGoal = greedy.GetMaxGoal(); Assert.AreEqual(8, maxGoal.g); }
public void Run_Grid4X4WithBlocked16_StopsByMemoryConstraint() { GridSearchNode initialState = _basicWorld4X416.GetInitialSearchNode <GridSearchNode>(); GreedyMax greedy = new GreedyMax(initialState, new GoalOnLocation(_basicWorld4X416.Goal)); Assert.IsNotNull(greedy); var howEnded = greedy.Run(Int32.MaxValue, 1); //One MB memory limit var maxGoal = greedy.GetMaxGoal(); Assert.IsNull(maxGoal); Assert.AreEqual(State.StoppedByMemoryLimit, howEnded); }