Exemplo n.º 1
0
        public Point?GetNext(string type, Point pos, DijkstraNeighbors neighbors, Random random)
        {
            var map       = Get(type);
            var nextMoves = map.FindNextMoves(pos, neighbors);

            return(map.FindNextUnblockedMove(nextMoves.Shuffle(random), IsBlocked));
        }
Exemplo n.º 2
0
        public static IEnumerable <Point> FindNextMoves(this IDijkstraMap dijkstra, Point start, DijkstraNeighbors neighbors)
        {
            double minDist = dijkstra.GetCost(start);

            foreach (var neighbor in neighbors(start))
            {
                double dist = dijkstra.GetCost(neighbor);
                if (dist < minDist)
                {
                    yield return(neighbor);
                }
            }
        }