Exemplo n.º 1
0
        public Dictionary <string, double[]> getYearOfGatherables(DailyTemps dailyTemps, DailyRain dailyRain, DailyVolume dailyVolume)
        {
            if (crops == null)
            {
                crops = new Dictionary <string, double[]>();
                List <string> activeHabitats            = getNonZeroHabitats();
                Dictionary <string, Plant> plantSpecies = World.plantSpecies;
                foreach (KeyValuePair <string, Plant> pair in plantSpecies)
                {
                    double habitatPercentage = 0.0;
                    if (pair.Value.habitats.Contains("All"))
                    {
                        habitatPercentage = (100 - typePercents[13] - typePercents[12]) * .01;
                    }
                    else if (pair.Value.habitats.Any(habitat => activeHabitats.Contains(habitat)))
                    {
                        foreach (string habitat in pair.Value.habitats)
                        {
                            habitatPercentage += typePercents[reverseHabitatMapping[habitat]] * .01;
                        }
                    }
                    if (!habitatPercentage.Equals(0.0))
                    {
                        double[] cropHistory = pair.Value.getYearOfCrop(habitatPercentage, dailyTemps, dailyRain, dailyVolume);
                        if (cropHistory != null)
                        {
                            crops.Add(pair.Key, cropHistory);
                        }
                    }
                }
            }

            return(crops);
        }
Exemplo n.º 2
0
 public void generateYearsTemps(int year)
 {
     int[] temps = new int[WorldDate.DAYS_PER_YEAR];
     for (int day = 1; day <= temps.Length; day++)
     {
         temps[day - 1] = temperatureEquation.getTodaysTemp(day);
     }
     dailyTemps = new DailyTemps(year, temps);
 }