Пример #1
0
        public static void PrintYearStatsSummary()
        {
            string text = "";

            Data.YearData lastYear = Data.DataContainer.GetLastYearData();

            text += "Insight" + Environment.NewLine;
            text += "<color=yellow>------------</color>" + Environment.NewLine;

            text += Data.Extrapolater.GetInsightForYear(Data.DataContainer.GetLastYearData());

            text += "<color=yellow>------------</color>" + Environment.NewLine;

            text += "Stats Summary" + Environment.NewLine;
            text += "<color=yellow>------------</color>" + Environment.NewLine;



            text += Data.Extrapolater.exp_FoodInsufficiency(lastYear);

            text += Data.Extrapolater.exp_FoodProductionCurrent();

            text += Data.Extrapolater.exp_FoodProductionMax();

            text += "<color=yellow>------------</color>";

            DebugExt.Log(text);
        }
Пример #2
0
        public static void OnYearEnd()
        {
            currentYearData.population = Analytics.GetPlayerKingdomPopulation();
            data.Add(currentYearData);

            currentYearData = YearData.Empty;
        }
Пример #3
0
        public static int GetRequiredFoodForYear(int yearNum)
        {
            YearData yearData = DataContainer.GetYearData(yearNum);

            return(yearData.foodConsumptionData.timesEaten - yearData.foodConsumptionData.timesSatisfied);
        }
Пример #4
0
 public static int GetRequiredFoodForYear(YearData yearData)
 {
     return(yearData.foodConsumptionData.timesEaten - yearData.foodConsumptionData.timesSatisfied);
 }
Пример #5
0
        public static string GetInsightForYear(YearData data)
        {
            string text = "";

            float overallAvgFoodConsumption = Analyzer.CalcAverageFoodConsumptionPerPerson(DataContainer.GetAllYearData());
            float percentChangeFromOverall  = CalculatePercentChange(overallAvgFoodConsumption, data.AvgFoodConsumptionPerPerson);

            float predictedFoodProductionCurrPop = Analyzer.GetPredictedFoodInsufficiencyForPeople(Analytics.GetPlayerKingdomPopulation(), DataContainer.GetAllYearData());
            float predictedFoodProductionMaxPop  = Analyzer.GetPredictedFoodInsufficiencyForPeople(Analytics.GetHousingForKingdom(), DataContainer.GetAllYearData());

            bool mention_foodConsumptionChange =
                Math.Abs(percentChangeFromOverall) > thresh_foodConsumptionRateIrregularity;
            bool mention_foodInsufficiency            = data.foodConsumptionData.FoodInsufficiency > thresh_foodInsufficiency;
            bool mention_productionInsufficentCurrPop = predictedFoodProductionCurrPop > thresh_foodProductionInsufficent;
            bool mention_productionInsufficientMaxPop = predictedFoodProductionMaxPop > thresh_foodProductionInsufficent;


            if (DataContainer.GetYearDataCount() >= sampleDataSignificanceThreshold)
            {
                if (mention_foodConsumptionChange)
                {
                    text += "This year people ate " +
                            Stringify(data.AvgFoodConsumptionPerPerson) +
                            " food per person. " +
                            Environment.NewLine;
                    text += "People usually eat " +
                            Stringify(overallAvgFoodConsumption) +
                            " food per person. " +
                            Environment.NewLine;

                    text += "People were " +
                            Stringify(Math.Abs(percentChangeFromOverall * 100)) + "%";
                    text += (percentChangeFromOverall > 0) ? " more " : " less ";;
                    text += "hungry than normal this year. It should be noted as irregular. " + Environment.NewLine;
                }

                if (mention_foodInsufficiency)
                {
                    if (!mention_foodConsumptionChange)
                    {
                        text += "This year, our food stores didn't contain enough to feed everyone, we needed " + data.foodConsumptionData.FoodInsufficiency + " more food. Consider increasing food production. ";
                    }
                    else
                    {
                        if (percentChangeFromOverall > 0)
                        {
                            text += "This year we did not have enough food for all the peasants. Food demand rose considerably, which could have attributed to our lack of food reserve. ";
                        }
                        else
                        {
                            text += "This year we were blessed with small bellied peasants, however our food storage still proved insubstantial, our food situation is dire!";
                        }
                    }
                    text += Environment.NewLine;
                }

                if (mention_productionInsufficentCurrPop)
                {
                    text += "We are losing too much food each year! Consider more food production. " + Environment.NewLine;
                }

                if (mention_productionInsufficientMaxPop)
                {
                    if (!mention_productionInsufficentCurrPop)
                    {
                        text += "While food production is currently enough to feed all, our city contains beds for more than we can feed!" + Environment.NewLine;
                    }
                    else
                    {
                        text += "Our city's food production will be too weak to sustain food when the city is full! " + Environment.NewLine;
                    }
                }

                if (text == "")
                {
                    text += "This year was uneventful, lord" + Environment.NewLine;
                }
            }
            else
            {
                text = "We have not yet collected enough sample data to give an accurate insight. " + Environment.NewLine;
            }

            return(text);
        }
Пример #6
0
 public static string exp_FoodInsufficiency(YearData data)
 {
     return("Food insufficiency this year: " +
            Analyzer.GetRequiredFoodForYear(data).ToString() +
            Environment.NewLine);
 }