public void SimulateSinglePeriod() { Thread.Sleep(10); ThisPeriodStats = new WorldStat { TimeIdx = TimeIdx, Population = Population, PeriodStartResourceLevel = ResourceLevel, MeanLibido = CalculateMeanLibido() }; // Run world events // Run organism events foreach (var group in Groups) { group.Live(); } //todo RemoveTheDead?(); // Run organism events foreach (var organism in Organisms) { organism.Live(); } RemoveTheDead(); AddTheBabies(); AdjustResourcesByCultivation(); ReplenishResources(); PeriodStats.Add(ThisPeriodStats); // Increment Time Index TimeIdx += TimeIncrement; }
/// <summary> /// How a group lives in one year /// Only action for now is if group will attack another group or not /// </summary> public void Live() { ThisPeriodStats = new GroupStat() { TimeIdx = TimeIdx, PeriodStartResourceLevel = StorageLevel, EconomyScore = EconomyScore, MilitaryScore = MilitaryScore, }; AddLogEntry(LogPriorityLive, "Population", StorageLevel, Population, LogLevel.EveryInterval); AddLogEntry(LogPriorityLive, "Economy", StorageLevel, EconomyScore, LogLevel.EveryInterval); AddLogEntry(LogPriorityLive, "Military", StorageLevel, MilitaryScore, LogLevel.EveryInterval); PeriodStats.Add(ThisPeriodStats); }