Exemple #1
0
 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}));
 }
Exemple #2
0
 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);
 }
Exemple #3
0
 public Path(Position start)
 {
     StartPosition = start;
     EndPosition = start;
     Distance = 0.0M;
 }