public ScenePainter(Map[] maps)
        {
            paths = maps.ToDictionary(x => x, x => TransformPath(x, My_DungeonTask.FindShortestPath(x)).ToArray());

            currentMap    = maps[0];
            mainIteration = 0;
            CreateMap();
        }
Esempio n. 2
0
        public void ReturnShortestPath3()
        {
            var map            = Map.FromText(Properties.Resources.BigTestDungeon);
            var expectedLength = 211;

            var path = My_DungeonTask.FindShortestPath(map);

            IsValidPath(map, path, expectedLength);
        }
Esempio n. 3
0
        public void ReturnCorrectPath_OnEmptyDungeon()
        {
            var textMap = new[]
            {
                "P ",
                "CE"
            };
            var map = Map.FromLines(textMap);

            var path = My_DungeonTask.FindShortestPath(map);

            Assert.AreEqual(new[] { MoveDirection.Down, MoveDirection.Right }, path);
        }
Esempio n. 4
0
        public void ReturnEmptyPath_WhenNoPathToExit()
        {
            var textMap = new[]
            {
                "P#",
                "#E"
            };
            var map = Map.FromLines(textMap);

            var path = My_DungeonTask.FindShortestPath(map);

            Assert.AreEqual(new MoveDirection[0], path);
        }
Esempio n. 5
0
        public void ReturnPathToExit_IfNoChests()
        {
            var textMap = new[]
            {
                "PE",
                "  "
            };
            var map = Map.FromLines(textMap);

            var path = My_DungeonTask.FindShortestPath(map);

            Assert.AreEqual(new[] { MoveDirection.Right }, path);
        }
Esempio n. 6
0
        public void Return_ShortestPath2()
        {
            var textMap = new[]
            {
                "ECC",
                " P ",
                "CCC"
            };
            var map = Map.FromLines(textMap);

            var path = My_DungeonTask.FindShortestPath(map);

            Assert.AreEqual(new[] { MoveDirection.Up, MoveDirection.Left }, path);
        }