Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
 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();
 }
Ejemplo n.º 3
0
        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());
        }
Ejemplo n.º 4
0
        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();
        }
Ejemplo n.º 5
0
 // 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;
 }
Ejemplo n.º 6
0
        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());
        }
Ejemplo n.º 7
0
        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);
        }