/// <summary>Returns a DirectedPath composed by extending this DirectedPath by one hex.</summary>
 internal DirectedPathCollection(DirectedPathCollection nextSteps, NeighbourHex neighbour, int totalCost)
 {
     PathStep   = neighbour;
     PathSoFar  = nextSteps;
     TotalCost  = totalCost;
     TotalSteps = nextSteps == null ? 0 : nextSteps.TotalSteps + 1;
 }
 /// <summary>TODO</summary>
 internal DirectedPath(DirectedPath nextSteps, NeighbourHex neighbour, int totalCost, int key)
 {
     PathStep   = neighbour;
     PathSoFar  = nextSteps;
     TotalCost  = totalCost;
     Key        = key;
     TotalSteps = nextSteps == null ? 0 : nextSteps.TotalSteps + 1;
 }
        void ExpandNeighbour(IDirectedPath path, NeighbourHex neighbour)
        {
            if (!OpenSet.Contains(neighbour.Hex.Coords))
            {
                var cost = StepCost(neighbour.Hex, neighbour.HexsideExit);
                if (cost > 0)
                {
                    var newPath = path.AddStep(neighbour, cost);
                    var key     = Estimate(Heuristic, VectorGoal, Source.Coords,
                                           neighbour.Hex.Coords, newPath.TotalCost);

                    TraceFindPathEnqueue(neighbour.Hex.Coords, key >> 16, (int)(key & 0xFFFFu));

                    Queue.Enqueue(key, newPath);
                }
            }
        }
 /// <inheritdoc/>
 public IDirectedPathCollection AddStep(NeighbourHex neighbour, int stepCost)
 {
     return(new DirectedPathCollection(this, neighbour, TotalCost + stepCost));
 }
        public IEnumerable <NeighbourHex> GetNeighbours()
        {
            var @this = this;

            return(NeighbourHex.GetNeighbours(@this).Where(n => @this.Board.IsOnBoard(n.Hex.Coords)));
        }
 /// <summary>TODO</summary>
 /// <param name="neighbour"></param>
 /// <param name="stepCost"></param>
 /// <param name="key"></param>
 /// <returns></returns>
 public DirectedPath AddStep(NeighbourHex neighbour, int stepCost, int key)
 {
     return(new DirectedPath(this, neighbour, TotalCost + stepCost, key));
 }
 /// <summary>TODO</summary>
 /// <param name="neighbour"></param>
 /// <param name="stepCost"></param>
 /// <returns></returns>
 public DirectedPath AddStep(NeighbourHex neighbour, int stepCost)
 {
     return(AddStep(neighbour, stepCost, stepCost));
 }