public ScenePainter(IReadOnlyList <Map> maps) { paths = maps.ToDictionary(x => x, x => TransformPath(x, DungeonTask.FindShortestPath(x)).ToArray()); currentMap = maps[0]; mainIteration = 0; CreateMap(); }
public void ReturnShortestPath3() { var map = Map.FromText(Properties.Resources.BigTestDungeon); var expectedLength = 211; var path = DungeonTask.FindShortestPath(map); IsValidPath(map, path, expectedLength); }
public void ReturnCorrectPath_OnEmptyDungeon() { var textMap = new[] { "P ", "CE" }; var map = Map.FromLines(textMap); var path = DungeonTask.FindShortestPath(map); Assert.AreEqual(new[] { MoveDirection.Down, MoveDirection.Right }, path); }
public void ReturnEmptyPath_WhenNoPathToExit() { var textMap = new[] { "P#", "#E" }; var map = Map.FromLines(textMap); var path = DungeonTask.FindShortestPath(map); Assert.AreEqual(new MoveDirection[0], path); }
public void ReturnPathToExit_IfNoChests() { var textMap = new[] { "PE", " " }; var map = Map.FromLines(textMap); var path = DungeonTask.FindShortestPath(map); Assert.AreEqual(new[] { MoveDirection.Right }, path); }
public void Return_ShortestPath2() { var textMap = new[] { "ECC", " P ", "CCC" }; var map = Map.FromLines(textMap); var path = DungeonTask.FindShortestPath(map); Assert.AreEqual(new[] { MoveDirection.Up, MoveDirection.Left }, path); }
public void ReturnPathToExit_IfChestIsUnreachable() { var textMap = new[] { "PE#", "###", "C " }; var map = Map.FromLines(textMap); var path = DungeonTask.FindShortestPath(map); Assert.AreEqual(new[] { MoveDirection.Right }, path); }