Esempio n. 1
0
        private IclusterIGCWrapper FindNearestUnexploredCluster()
        {
            IclusterIGCWrapper nearestCluster = null;
            int nearestClusterDistance        = int.MaxValue;

            foreach (var unexploredClusterObjectID in GameInfo.UnexploredClustersByObjectID.Keys)
            {
                var fromCluster = _client.GetShip().GetCluster();
                var toCluster   = _client.GetCore().GetCluster((short)unexploredClusterObjectID);

                DijkstraPathFinder pathFinder = new DijkstraPathFinder(_client.GetCore(), fromCluster, toCluster);

                int distance = pathFinder.GetDistance(fromCluster, toCluster);

                if (distance < nearestClusterDistance)
                {
                    nearestCluster = toCluster;
                }
            }

            return(nearestCluster);
        }