예제 #1
0
        public void FloodCrateMoveMap()
        {
            SokobanMap map = new SokobanMap();
            map.setFromStrings(new string[]
                                   {
            "~~~###~~~~~",
            "~~##.#~####",
            "~##..###..#",
            "##.X......#",
            "#...PX.#..#",
            "###.X###..#",
            "~~#..#OO..#",
            "~##.##O#.##",
            "~#......##~",
            "~#.....##~~",
            "~#######~~~"
                                   });

            Bitmap result = CrateAnalysis.BuildCrateMoveMap(map, new VectorInt(3,3));
            Assert.IsNotNull(result);

            Debug.WriteLine(map.ToString());
            Debug.WriteLine(result.ToString());
            Debug.WriteLine("done.");
        }
        private static int TestSimplePuzzle()
        {
            SokobanMap map = new SokobanMap();
            map.setFromStrings(new string[]
                                   {
            "~~~###~~~~~",
            "~~##.#~####",
            "~##..###..#",
            "##.X......#",
            "#...PX.#..#",
            "###.X###..#",
            "~~#..#OO..#",
            "~##.##O#.##",
            "~#......##~",
            "~#.....##~~",
            "~#######~~~"
                                   });

            PuzzleMap pMap = new PuzzleMap(null);
            pMap.Map = map;

            SolverAPI api = new SolverAPI();
            List<INode<SolverNode>> results = api.Solve(pMap);

            if (results == null || results.Count== 0)
            {
                Console.WriteLine("No Solutions found.");
                return -1;
            }

            return 0;
        }
예제 #3
0
        public void TestFindCratePath()
        {
            SokobanMap map = new SokobanMap();
            map.setFromStrings(new string[]
                                   {
            "~~~###~~~~~",
            "~~##.#~####",
            "~##..###..#",
            "##.X......#",
            "#...PX.#..#",
            "###.X###..#",
            "~~#..#OO..#",
            "~##.##O#.##",
            "~#......##~",
            "~#.....##~~",
            "~#######~~~"
                                   });

            CrateAnalysis.ShortestCratePath result = CrateAnalysis.FindCratePath(map, new VectorInt(3, 3), new VectorInt(9, 5));
            Assert.IsNotNull(result);

            Debug.WriteLine(map.ToString());
            Debug.WriteLine(result.CratePath.ToString());
            Debug.WriteLine(result.PlayerPath.ToString());
            Debug.WriteLine("done.");
        }