Пример #1
0
        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);
        }