public void TestPathingOptions() { var pathfinderOptions = new PathFinderOptions { PunishChangeDirection = true }; var pathfinder = new PathFinder(_grid, pathfinderOptions); var path = pathfinder.FindPath(new Point(1, 1), new Point(30, 30)); Helper.Print(_grid, path); }
public void ShouldDoSimplePathWithNoDiagonalAroundObstacle() { var pathfinderOptions = new PathFinderOptions { Diagonals = false }; _pathFinder = new PathFinder(_grid, pathfinderOptions); _grid[2, 0] = 0; _grid[2, 1] = 0; _grid[2, 2] = 0; var path = _pathFinder.FindPath(new Point(1, 1), new Point(4, 2)); Helper.Print(_grid, path); PrintCoordinates(path); path.Count.ShouldBe(7); var item = path[6]; item.X.ShouldBe(1); item.Y.ShouldBe(1); item = path[5]; item.X.ShouldBe(1); item.Y.ShouldBe(2); item = path[4]; item.X.ShouldBe(1); item.Y.ShouldBe(3); item = path[3]; item.X.ShouldBe(2); item.Y.ShouldBe(3); item = path[2]; item.X.ShouldBe(3); item.Y.ShouldBe(3); item = path[1]; item.X.ShouldBe(3); item.Y.ShouldBe(2); item = path[0]; item.X.ShouldBe(4); item.Y.ShouldBe(2); }