static void Main(string[] args) { Logger.OpenLogFile(@"e:\ES\1.txt"); int wSizeX = 100, wSizeY = 100; Cell[,] cells = new Cell[wSizeX, wSizeY]; int countOfWorldSteps = 100; int foodIncrease = 14; int initFoodCount = foodIncrease * 50; for (int i = 0; i < wSizeX; i++) { for (int j = 0; j < wSizeY; j++) { cells[i, j] = new Cell(initFoodCount, foodIncrease); } } Evolution evolution = new Evolution(); World world = new World(evolution, cells); var firstPopulation = evolution.MakeFirstPopulation(); world.AddCreature(firstPopulation[0], new Run.Orientation(wSizeX - 1, wSizeY - 1)); world.AddCreature(firstPopulation[1], new Run.Orientation(0, 0)); #region Запись в файл информации о мире //Logger.Log($"World parameters:"); //Logger.Log($"World size X={wSizeX}"); //Logger.Log($"World size Y={wSizeY}"); //for (int i = 0; i < wSizeX; i++) //{ // for (int j = 0; j < wSizeY; j++) // { // Logger.Log($"Cell[{i}, {j}]=(Food={cells[i, j].FoodCount}, FoodIncrease={cells[i, j].FoodIncrease})"); // } //} //Logger.Log($"\nCreatureParameters constants:"); //Logger.Log($"Alpha1={CreatureParameters.alpha1}"); //Logger.Log($"MaxHealth(1)={CreatureParameters.MaxHealth(1)}"); //Logger.Log($"h1(1)={CreatureParameters.h1(1)}"); //Logger.Log($"RegenerationValue(1)={CreatureParameters.RegenerationValue(1)}"); //Logger.Log($"InitEnergy(1)={CreatureParameters.InitEnergy(1)}"); //Logger.Log($"e1(1)={CreatureParameters.e1(1)}"); //Logger.Log($"e2(1)={CreatureParameters.e2(1)}"); //Logger.Log($"AbsorbAble(1)={CreatureParameters.AbsorbAble(1)}"); //Logger.Log($"HitForce(1)={CreatureParameters.HitForce(1)}"); //Logger.Log(""); //Logger.Log($"First Population:\n{world.StatesOfCreatures()}"); //Logger.Log(""); #endregion string[] chartAreaNames = new string[] { "All Food", "Absorbtion of food", "Creature populations" /*, "Death info", "Uniformity of distribution" */ }; List <SeriesSettings> series = new List <SeriesSettings>() { new SeriesSettings("All food", chartAreaNames[0], Color.Brown, countOfWorldSteps), new SeriesSettings("Total absorbtion of food", chartAreaNames[1], Color.Blue, countOfWorldSteps), new SeriesSettings($"Population of {(int)evolution.Alphas[0]}-Alpha", chartAreaNames[2], Color.Red, countOfWorldSteps), new SeriesSettings($"Population of {(int)evolution.Alphas[1]}-Alpha", chartAreaNames[2], Color.Green, countOfWorldSteps)/*, * new SeriesSettings("Deaths in fight", chartAreaNames[3], Color.DarkRed, countOfWorldSteps), * new SeriesSettings("Deaths from starvation", chartAreaNames[3], Color.DarkGray, countOfWorldSteps), * new SeriesSettings("Uniformity", chartAreaNames[4], Color.DarkGoldenrod, countOfWorldSteps)*/ }; for (int i = 1; i <= countOfWorldSteps; i++) { AddData(world, series); //Console.WriteLine($"{i} TF={totalFood:.00} TAoF={totalFoodConsumption:.00} S{(int)evolution.Alphas[0]}C={alpha0:0000} S{(int)evolution.Alphas[1]}C={alpha1:0000}"); //Console.WriteLine(i); // alpha2Count={alpha2:0000} alpha8Count={alpha8:0000} Count of: Eat={world.CountOfActions[(int)CreatureAction.Eat]} Go={world.CountOfActions[(int)CreatureAction.Go]} Hit={world.CountOfActions[(int)CreatureAction.Hit]} Repr={world.CountOfActions[(int)CreatureAction.Reproduce]} //Logger.Log($"World step={i:0000000}"); world.MakeInteractions(); } AddData(world, series); //Logger.Log($"Count of: Eat={world.CountOfActions[(int)CreatureAction.Eat]} Go={world.CountOfActions[(int)CreatureAction.Go]} Hit={world.CountOfActions[(int)CreatureAction.Hit]} Repr={world.CountOfActions[(int)CreatureAction.Reproduce]}"); File.WriteAllText($"e:\\es\\results of foodIncrease {foodIncrease}.txt", JsonSerializer.Serialize(series)); Console.WriteLine($"food increase = {foodIncrease} done."); ChartForm chartForm = new ChartForm(chartAreaNames, series); chartForm.ShowDialog(); Logger.CloseLogFile(); }