/// <summary>Populates and returns a new landmark at the specified board coordinates.</summary>
 /// <param name="hexCoords"><see cref="HexCoords"/> for the landmark to be created.</param>
 /// <param name="mapSizeHexes">Hex dimensions of the IBoard{IHex} on which the landmark is to be created.</param>
 /// <param name="queueFactory">Factory that creates empty instances of <c>IPriorityQueue</c>.</param>
 /// <param name="tryDirectedCosts">TODO</param>
 private DirectedLandmark(HexCoords hexCoords, HexSize mapSizeHexes,
                          Func <IPriorityQueue <int, HexCoords> > queueFactory,
                          TryDirectedCost tryDirectedCosts
                          )
 {
     //  _hex          = hex;
     _backingStore = new LandmarkPopulatorFunctor(hexCoords, mapSizeHexes, queueFactory, tryDirectedCosts).Fill();
 }
 public LandmarkPopulator(
     HexCoords hex,
     HexSize mapSizeHexes,
     Func <IPriorityQueue <int, HexCoords> > queueFactory,
     TryDirectedCost tryDirectedStepCost
     ) : base(hex, mapSizeHexes, queueFactory, tryDirectedStepCost)
 {
 }
 public static DirectedLandmark New(HexCoords hexCoords, HexSize mapSizeHexes,
                                    Func <IPriorityQueue <int, HexCoords> > queueFactory,
                                    TryDirectedCost tryDirectedCosts
                                    )
 {
     return(Extensions.InitializeDisposable(() =>
                                            new DirectedLandmark(hexCoords, mapSizeHexes, queueFactory, tryDirectedCosts)));
 }
        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));
            });
        }
        public LandmarkPopulatorFunctor(
            HexCoords hexCoords,
            HexSize mapSizeHexes,
            Func <IPriorityQueue <int, HexCoords> > queueFactory,
            TryDirectedCost tryDirectedStepCost
            )
        {
            Tracing.FindPathDetail.Trace("Find distances from {0}", hexCoords);

            _queue = queueFactory();
            _store = BlockedBoardStorage.New32x32(mapSizeHexes, c => default(short?));
            _tryDirectedStepCost = tryDirectedStepCost;

            Enqueue(0, hexCoords, _store);
        }