public void Run_NewAStarBox() { World w = new World(5, 2, 2); var heuristicFunc = new SnakeNoneHeuristic(); int[] snakeHeads = new int[] { 0, 31 }; BoxOD b = new BoxOD(w, snakeHeads, new BoxNoneHeuristic(), heuristicFunc); DfBnbMax dfBnbMax = new DfBnbMax(b, new ImplicitGoal()); dfBnbMax.Run(1); var maxGoal = dfBnbMax.GetMaxGoal(); Assert.IsNotNull(maxGoal); }
public void Calculate_RightBoxODSnakesSumHeuristic() { World w = new World(7, 2, 3); int[] snakeHeads = new int[] { 0, 127 }; Box b = new BoxOD(w, snakeHeads, new BoxSnakesSumHeuristic(), new SnakeLegalHeuristic()); Assert.AreEqual(0, b.g); Assert.AreEqual(128, b.h); Assert.AreEqual(128, b.f); var lstGen = b.Children; Assert.AreEqual(0, lstGen.Last.Value.g); Assert.AreEqual(127, lstGen.Last.Value.h); Assert.AreEqual(127, lstGen.Last.Value.f); lstGen = lstGen.Last.Value.Children; Assert.AreEqual(1, lstGen.Last.Value.g); Assert.AreEqual(126, lstGen.Last.Value.h); Assert.AreEqual(127, lstGen.Last.Value.f); }
public void Calculate_RightBoxODShortestSnakeReachableHeuristic() { World w = new World(7, 2, 3); int[] snakeHeads = new int[] { 0, 127 }; Box b = new BoxOD(w, snakeHeads, new BoxShortestSnakeReachableHeuristic(), new SnakeNoneHeuristic()); Assert.AreEqual(0, b.g); Assert.AreEqual(127, b.h); Assert.AreEqual(127, b.f); var lstGen = b.Children; Assert.AreEqual(0, lstGen.Last.Value.g); Assert.AreEqual(127, lstGen.Last.Value.h); Assert.AreEqual(127, lstGen.Last.Value.f); lstGen = lstGen.First.Value.Children; Assert.AreEqual(1, lstGen.Last.Value.g); Assert.AreEqual(127, lstGen.Last.Value.h); Assert.AreEqual(128, lstGen.Last.Value.f); lstGen = lstGen.First.Value.Children; Assert.AreEqual(1, lstGen.Last.Value.g); Assert.AreEqual(119, lstGen.Last.Value.h); Assert.AreEqual(120, lstGen.Last.Value.f); lstGen = lstGen.First.Value.Children; Assert.AreEqual(2, lstGen.Last.Value.g); Assert.AreEqual(111, lstGen.Last.Value.h); Assert.AreEqual(113, lstGen.Last.Value.f); lstGen = lstGen.First.Value.Children; Assert.AreEqual(2, lstGen.Last.Value.g); Assert.AreEqual(105, lstGen.Last.Value.h); Assert.AreEqual(107, lstGen.Last.Value.f); lstGen = lstGen.First.Value.Children; Assert.AreEqual(3, lstGen.Last.Value.g); Assert.AreEqual(99, lstGen.Last.Value.h); Assert.AreEqual(102, lstGen.Last.Value.f); }
public void Calculate_RightBoxODLegalHeuristic() { World w = new World(7, 2, 3); int[] snakeHeads = new int[] { 0, 127 }; Box b = new BoxOD(w, snakeHeads, new BoxLegalHeuristic(), new SnakeNoneHeuristic()); Assert.AreEqual(0, b.g); Assert.AreEqual(114, b.h); Assert.AreEqual(114, b.f); var lstGen = b.Children; Assert.AreEqual(0, lstGen.Last.Value.g); Assert.AreEqual(108, lstGen.Last.Value.h); Assert.AreEqual(108, lstGen.Last.Value.f); lstGen = lstGen.First.Value.Children; Assert.AreEqual(1, lstGen.Last.Value.g); Assert.AreEqual(102, lstGen.Last.Value.h); Assert.AreEqual(103, lstGen.Last.Value.f); lstGen = lstGen.First.Value.Children; Assert.AreEqual(1, lstGen.Last.Value.g); Assert.AreEqual(97, lstGen.Last.Value.h); Assert.AreEqual(98, lstGen.Last.Value.f); }