Example #1
0
        /// <summary>
        /// Calcs the max gain using this many ships.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="arrival">The arrival.</param>
        /// <param name="numShips">The num ships.</param>
        /// <returns></returns>
        internal PlanetTurn CalcMaxGainUsingThisManyShips(Planet source, int arrival, int numShips)
        {
            Planet clone = Clone(true);

            clone.CreateTurns(TurnPrediction.Count);
            Fleet attack = new Fleet(1, numShips, source, clone, arrival, arrival);

            clone.CreateTurnPredictions();
            return(clone.TurnPrediction.LastTurn);
        }
        private Planet BuildPlanet(int planetID, string[] tokens)
        {
            Planet result;
            int    owner    = ParseInt(tokens[3]);
            int    numShips = ParseInt(tokens[4]);

            if (!Planets.TryGetValue(planetID, out result))
            {
                double x          = ParseDouble(tokens[1]);
                double y          = ParseDouble(tokens[2]);
                int    growthRate = ParseInt(tokens[5]);
                result = new Planet(planetID, owner, numShips, growthRate, x, y);
                result.CreateTurns(40);
                Planets.Add(planetID, result);
            }
            else
            {
                result.SynchronizeWithGameStatus(owner, numShips);
            }
            return(result);
        }