private void InvokeInner(Hexside hexside, HexCoords here, short cost)
        {
            //!< Reduce field references by keeping these on stack.
            var neighbour = here.GetNeighbour(hexside);
            var store     = _store;

            if (store.MapSizeHexes.IsOnboard(neighbour))
            {
                store[neighbour].ElseDo(() => Enqueue(cost, neighbour, store));
            }
        }
        private void Action(
            IPriorityQueue <int, HexCoords> queue,
            BoardStorage <short?> store,
            TryDirectedCost tryDirectedStepCost,
            HexCoords here, int key, Hexside hexside
            )
        {
            var neighbour = here.GetNeighbour(hexside);

            tryDirectedStepCost(here, hexside).IfHasValueDo(stepCost => {
                store[neighbour].ElseDo(() => Enqueue((short)(key + stepCost), neighbour, store));
            });
        }
Beispiel #3
0
        #pragma warning restore 3008

        /// <inheritdoc/>
        public void ForAllNeighbours(HexCoords coords, Action <T, Hexside> action)
        => Hexside.ForEach(hexside =>
                           action(this[coords.GetNeighbour(hexside)], hexside)
                           );
Beispiel #4
0
 /// <inheritdoc/>
 public T    Neighbour(HexCoords coords, Hexside hexside) =>
 this[coords.GetNeighbour(hexside)];
 /// <summary>TODO</summary>
 public static HexsideCosts EntryCosts <THex>(BoardStorage <Maybe <THex> > boardHexes, HexCoords hexCoords)
     where THex : IHex
 => new HexsideCosts(hexside => DirectedCost(boardHexes, hexCoords.GetNeighbour(hexside), hexside.Reversed));