Пример #1
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();
 }
Пример #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());
        }
Пример #3
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();
        }
Пример #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());
        }