public void TestRoom() { string[] puzzle = new string[] { "~~###########", "~##.....#..P#", "###.X.XX#...#", "#.##X....XX.#", "#..#..X.#...#", "######.######", "#OO.OOX.#$##~", "#.OO....###~~", "#..OO#####~~~", "#########~~~~" }; SokobanMap map = new SokobanMap(); map.SetFromStrings(puzzle); PuzzleMap pMap = new PuzzleMap((Puzzle)null); pMap.Map = map; SolverController solver = new SolverController(pMap); solver.Init(); }
public void TestReverseStrategyCoreSimple() { CodeTimer timer = new CodeTimer(""); timer.Start(); try { SokobanMap map = new SokobanMap(); map.SetFromStrings(new string[] { "~##~#####", "##.##.O.#", "#.##.XO.#", "~##.X...#", "##.XP.###", "#.X..##~~", "#OO.##.##", "#...#~##~", "#####~#~~" }); PuzzleMap pMap = new PuzzleMap((Puzzle)null); pMap.Map = map; SolverController controller = new SolverController(pMap); controller.Init(); controller.State = SolverController.States.Running; // Manually set state, as we are not using the controller; but the strategy uses the controller to check if it should exit ReverseStrategy rev = new ReverseStrategy(controller); Evaluator<SolverNode> eval = new Evaluator<SolverNode>(); EvalStatus result = eval.Evaluate(rev); Assert.AreEqual(EvalStatus.CompleteSolution, result, "Should find a solution"); } finally { timer.Stop(); System.Console.WriteLine("Total Time: " + timer.Duration(1)); } }