Exemple #1
0
        private void PlotJourney()
        {
            Console.WriteLine("  Plotting journeys ...");
            SystemDistance?distance;

            while ((distance = GetShortestDistance()) != null)
            {
                EstablishConnection(distance);
            }

            if (journeyJumps < _systems.Length)
            {
                Console.WriteLine("  Calculating distances for final bucket ...");
                var finalBucket = new SystemBucket(_systems.Where(s => s.Connections.Count < 2));
                finalBucket.InitializeDistances();
                _buckets = new List <SystemBucket> {
                    finalBucket
                };
            }

            while ((distance = GetShortestDistance()) != null)
            {
                EstablishConnection(distance);
            }
        }
Exemple #2
0
        private void AddToBucket(JourneySystem system, CoordF sysCoord, Dictionary <CoordF, SystemBucket> buckets)
        {
            var bucketCoord = new CoordF(
                (int)(sysCoord.X / _bucketSize),
                (int)(sysCoord.Y / _bucketSize),
                (int)(sysCoord.Z / _bucketSize)
                );
            var bucket = buckets.TryGetValue(bucketCoord, out var b)
                ? b
                : buckets[bucketCoord] = new SystemBucket();

            bucket.Add(system);
        }