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

            currentMap    = maps[0];
            mainIteration = 0;
            CreateMap();
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }