private Path(Path source, Position position, decimal distance) { this.StartPosition = source.StartPosition; this.EndPosition = position; this.Distance = source.Distance + distance; this._pathPositions.AddRange(source._pathPositions.Concat(new [] {position})); }
public IEnumerable<Path> FindPath(Position start, decimal distance) { var newPath = new Path(start); var resultDict = new Dictionary<Position, Path> {{newPath.EndPosition, newPath}}; FindPaths(new Path(start), distance, resultDict); return resultDict.Values.Where(x => x.Distance > 0).OrderBy(x => x.Distance); }
public Path(Position start) { StartPosition = start; EndPosition = start; Distance = 0.0M; }