示例#1
0
 private static IEnumerable<Map> LoadLevels()
 {
     yield return Map.FromText(Resources.Dungeon1);
     yield return Map.FromText(Resources.Dungeon2);
     yield return Map.FromText(Resources.Dungeon3);
     yield return Map.FromText(Resources.Dungeon4);
     yield return Map.FromText(Resources.BigTestDungeon);
 }
示例#2
0
        public void ReturnShortestPath3()
        {
            var map            = Map.FromText(Properties.Resources.BigTestDungeon);
            var expectedLength = 211;

            var path = DungeonTask.FindShortestPath(map);

            IsValidPath(map, path, expectedLength);
        }
示例#3
0
        private static IEnumerable <Map> LoadLevels()
        {
            yield return(Map.FromText(Properties.Resources.Dungeon1));

            yield return(Map.FromText(Properties.Resources.Dungeon2));

            yield return(Map.FromText(Properties.Resources.Dungeon3));

            yield return(Map.FromText(Properties.Resources.Dungeon4));
        }
        public void Return_ShortestPaths_OnBigTestDangeon()
        {
            var map             = Map.FromText(Properties.Resources.BigTestDungeon);
            var expectedLengths = new[] { 170, 156, 144, 137, 84 };

            var paths = GetPaths(map)
                        .OrderByDescending(x => x.Count)
                        .ToArray();

            AssertPaths(paths, map, expectedLengths);
        }
        public void WorksCorrect_ShortestPaths_OnManyCalls()
        {
            var miniMap = Map.FromLines(new[]

            {
                " C ",
                "CPC",
                " C "
            });
            var miniPaths = GetPaths(miniMap);

            AssertPaths(miniPaths, miniMap, new[] { 2, 2, 2, 2 });

            var map   = Map.FromText(Properties.Resources.BigTestDungeon);
            var paths = GetPaths(map)
                        .OrderByDescending(x => x.Count)
                        .ToArray();

            AssertPaths(paths, map, new[] { 170, 156, 144, 137, 84 });
        }