Beispiel #1
0
        private static void ReportEndOfYearStatistics()
        {
            foreach (Tribe t in tribes)
            {
                StatisticsCollector.ReportCountEvent(t.TribeName, "Tribes in the world.");
                StatisticsCollector.ReportSumEvent(t.TribeName, "Population", t.Population);
            }

            World.tribes.Parallel((tribe) => { tribe.ReportEndOfYearStatistics(); });
            if (WorldProperties.CollectLiveMemes > 0.5)
            {
                StatisticsCollector.ReportGlobalSumEvent("Live memes", Meme.CountLiveMemes());
            }
        }
Beispiel #2
0
        public double GoHunting(AvailableFeatures huntingEfficiencyFeature)
        {
            double sumHuntingPowers       = 0;
            double cooperationCoefficient = 0;
            int    numHunters             = 0;

            foreach (Tribesman man in members)
            {
                var chance = man.GetFeature(AvailableFeatures.LikelyhoodOfNotBeingAFreeRider);
                if (randomizer.Chance(chance))
                {
                    double huntingEfforts = man.GoHunting(huntingEfficiencyFeature);
                    if (huntingEfforts > 0)
                    {
                        sumHuntingPowers       += huntingEfforts;
                        cooperationCoefficient += man.GetFeature(AvailableFeatures.CooperationEfficiency);
                        numHunters++;
                    }
                }
                else
                {
                    man.SkipHunting();
                }
            }
            if (members.Count > 0)
            {
                StatisticsCollector.ReportAverageEvent(TribeName, "Percentage of hunters", (double)numHunters / members.Count);
            }
            if (numHunters == 0)
            {
                return(0);
            }
            cooperationCoefficient /= numHunters;
            StatisticsCollector.ReportAverageEvent(TribeName, "Average hunting efforts", sumHuntingPowers * cooperationCoefficient);
            StatisticsCollector.ReportSumEvent(TribeName, "Total hunting efforts", sumHuntingPowers * cooperationCoefficient);

            return(sumHuntingPowers * cooperationCoefficient);
        }