예제 #1
0
 private static void ChangeSpeed(OrganismPrototype organismExemplar)
 {
     if (RandomIntGenerator.random.Next(1, 4) == 1)
     {
         organismExemplar.Speed = RandomIntGenerator.random.Next(1, 6);
     }
 }
예제 #2
0
 public void EnvironmentCycle(OrganismPrototype organismExmp)
 {
     Temperature += _changer.ChangeTemperature();
     FoodAmount  += _changer.GenerateFood();
     FoodAmount  -= organismExmp.FoodConsumption * organismExmp.Population;
     Radiation   += _changer.ChangeRadiation();
 }
예제 #3
0
        public Launcher(int userPopulation = 10, int tempResistRange = 10)
        {
            organism           = new Organism(tempResistRange, -tempResistRange, userPopulation);
            statisticCollector = StatisticCollector.GetInstance();

            _changer     = new EnvironmentChanger(10, 500);
            _environment = new Environment(300, 0, _changer);
        }
예제 #4
0
        private static void ChangeTemperatureResist(OrganismPrototype organismExemplar, Environment environmentExemplar)
        {
            if (organismExemplar.MaxTempResist < environmentExemplar.Temperature)
            {
                organismExemplar.MaxTempResist += RandomIntGenerator.random.Next(0, 1);
                organismExemplar.MinTempResist--;
            }

            if (organismExemplar.MinTempResist > environmentExemplar.Temperature)
            {
                organismExemplar.MinTempResist += RandomIntGenerator.random.Next(0, 1);
                organismExemplar.MaxTempResist--;
            }
        }
예제 #5
0
        public static void NaturalSelection(OrganismPrototype organism, Environment envExmp)
        {
            if (envExmp.Temperature > organism.MaxTempResist || envExmp.Temperature < organism.MinTempResist)
            {
                organism.Population--;
            }
            if (envExmp.FoodAmount < organism.FoodConsumption * organism.Population)
            {
                organism.Population--;
            }

            //TODO: remake RAD reaction
            if (organism.Speed < 3)
            {
                int eated = RandomIntGenerator.random.Next(0, 5);
                organism.Population       -= eated;
                organism.EatedByPredators += eated;
            }
        }
예제 #6
0
 public static void Evolute(OrganismPrototype organismExemplar, Environment environmentExemplar)
 {
     ChangeTemperatureResist(organismExemplar, environmentExemplar);
     ChangeSpeed(organismExemplar);
 }