Пример #1
0
        /// <summary>
        /// Update each ship and dropoff for the player.
        /// </summary>
        public void _update(int numShips, int numDropoffs, int halite)
        {
            this.halite = halite;

            ships.Clear();
            for (int i = 0; i < numShips; ++i)
            {
                Ship ship = Ship._generate(id);
                ships[ship.id.id] = ship;
            }

            dropoffs.Clear();
            for (int i = 0; i < numDropoffs; ++i)
            {
                Dropoff dropoff = Dropoff._generate(id);
                dropoffs[dropoff.id.id] = dropoff;
            }
        }
Пример #2
0
        /// <summary>
        /// Update each ship and dropoff for the player.
        /// </summary>
        public void _update(int numShips, int numDropoffs, int halite)
        {
            this.halite = halite;

            var previousShips = ships.Values.ToList();

            ships.Clear();
            for (int i = 0; i < numShips; ++i)
            {
                Ship ship = Ship._generate(id, previousShips);
                ships[ship.Id] = ship;
            }

            dropoffDictionary.Clear();
            for (int i = 0; i < numDropoffs; ++i)
            {
                Dropoff dropoff = Dropoff._generate(id);
                dropoffDictionary[dropoff.id.id] = dropoff;
            }

            ShipsSorted = ships.Values.OrderBy(s => SpecialDistance(s, s.ClosestDropoff)).ToList();
        }