public static Path Create(Entities.Path path) { if (path == null) { return(null); } return(new Path(path.TripId, path.LocationText, path.DestinationText, path.Location, path.Destination, path.StartDate, path.EndDate, path.IsPinned, path.JsonObject, path.Order)); }
private Entities.Path RetracePath() { var result = new Entities.Path(); var spc = _board[_board.LastIndex]; result.Add(spc); for (int i = spc.DistanceFromStart.Value - 1; i > 0; i--) { spc = _board.NeighborsAtDistance(i, spc.Index).First(); result.Add(spc); } return result.Reverse(); }
private Entities.Path RetracePath() { var result = new Entities.Path(); var spc = _board[_board.LastIndex]; result.Add(spc); for (int i = spc.DistanceFromStart.Value - 1; i > 0; i--) { spc = _board.NeighborsAtDistance(i, spc.Index).First(); result.Add(spc); } return(result.Reverse()); }
private Entities.Path RetraceSteps(Entities.Grid grid, Entities.GridLocation endPoint) { var resultPath = new Entities.Path(); var currentLocation = grid[endPoint.X, endPoint.Y]; resultPath.Add(currentLocation); var pathLength = currentLocation.DistanceFromStart.Value; for (int i = pathLength - 1; i >= 0; i--) { currentLocation = grid.LocationsAtDistance(i).SurroundingLocation(currentLocation).First(); resultPath.Add(currentLocation); } return resultPath.Reverse(); }
// Take all ladders and skip all chutes public Entities.Path GetPath() { var result = new Entities.Path(); var i = 1; while (i <= _board.LastIndex) { var space = _board[i]; result.Add(space); if (space.PathTo.HasValue && space.PathTo.Value > i) { space = _board[space.PathTo.Value]; result.Add(space); } i = space.Index + 1; } return result; }
private Entities.Path RetraceSteps(Entities.Grid grid, Entities.GridLocation endPoint) { var resultPath = new Entities.Path(); var currentLocation = grid[endPoint.X, endPoint.Y]; resultPath.Add(currentLocation); var pathLength = currentLocation.DistanceFromStart.Value; for (int i = pathLength - 1; i >= 0; i--) { currentLocation = grid.LocationsAtDistance(i).SurroundingLocation(currentLocation).First(); resultPath.Add(currentLocation); } return(resultPath.Reverse()); }
public Entities.Path GetPath() // Take all ladders and skip all chutes { var result = new Entities.Path(); var i = 1; while (i <= _board.LastIndex) { var space = _board[i]; result.Add(space); if (space.PathTo.HasValue && space.PathTo.Value > i) { space = _board[space.PathTo.Value]; result.Add(space); } i = space.Index + 1; } return(result); }