Esempio n. 1
0
        public SimulationController()
        {
            model.PlanetCondition.PlanetConditionState state = new model.PlanetCondition.PlanetConditionState
            {
                freeWater = 0,
                organic   = 0,
                co        = 23830000000000000,
                n         = 675000000000000,
                oxigen    = 32500000000000,
                //TODO temperature
                temperature = -40
            };

            model.ColonyStats stats = new model.ColonyStats
            {
                num  = 10,
                mass = 10
            };

            model.ColonyParams par = ParamsController.colonyParams;

            model.PlanetCondition contitions = new model.PlanetCondition(state, ParamsController.growthSpeed);
            model.Colony          colony     = new model.Colony(stats, par);

            _currentColony = colony;
            _conditions    = contitions;
            defaultTemp    = _conditions.getTemperature();
        }
Esempio n. 2
0
        public void start(int ticks)
        {
            if (!ticksFinished())
            {
                return;
            }

//             if (totalTicks % 8 == 0)
//             {
//                 _conditions = _conditions.withTempearture(-60);
//             }

            _simTread = new Thread(() => {
                model.PlanetCondition conditions = _conditions;
                model.Colony colony = _currentColony;

                for (int i = 0; i < ticks; ++i)
                {
                    if (colony.isDead())
                    {
                        break;
                    }
                    SimTick tick        = new SimTick();
                    SimStep.StepRes res = tick.execute(conditions, colony);
                    conditions          = res.conditions;
                    colony = res.colony;
                    ++totalTicks;
                }

                _conditions    = conditions.withTempearture(defaultTemp);
                _currentColony = colony;
                //TODO mutate
            });
            _simTread.Start();
        }
Esempio n. 3
0
 public void UpdateColonyUI(model.Colony colonyInfo)
 {
     _totalMassText.text             = "Total mass: " + GetTotalMass(colonyInfo);
     _radiationResistanceText.text   = "Radiation resistance: " + GetRadiationResistance(colonyInfo);
     _temperatureResistanceText.text = "Optimal temperature: " + GetTemperatureResistance(colonyInfo);
     _maxSizeText.text             = "Size: " + GetMaxSize(colonyInfo);
     _photosynthesisPowerText.text = "Photosynthesis power: " + GetPhotoPower(colonyInfo);
     _nitrogenPowerText.text       = "Nytrogen power: " + GetNitrogenPower(colonyInfo);
 }
Esempio n. 4
0
 //public abstract float getSmallCellDeathRate(ColonyStats stats);
 public abstract float getUptakeDeathRate(Colony colony, double co, double water, double n, int time);
Esempio n. 5
0
 public override double getRequiredN(Colony colony, int time)
 {
     return(colony.getMass() * 0.1 * time);
 }
Esempio n. 6
0
 public abstract float getDivRate(Colony colony);
Esempio n. 7
0
 private double GetTemperatureResistance(model.Colony colonyInfo)
 {
     return(colonyInfo.getOptimalTemperature());
 }
Esempio n. 8
0
 private double GetPhotoPower(model.Colony colonyInfo)
 {
     return(System.Math.Round(colonyInfo.getPhotosynthesisPower(), 5));
 }
Esempio n. 9
0
 public override double getRequiredCO(Colony colony, int time)
 {
     return(colony.getPhotosynthesisPower() * colony.getMass() * time);
 }
Esempio n. 10
0
 private double GetTotalMass(model.Colony colonyInfo)
 {
     return(colonyInfo.getMass());
 }
Esempio n. 11
0
        public override double getRequiredWater(Colony colony, int time)
        {
            double metabolism = getMetabolicWater(colony, time);

            return(metabolism + colony.getMass());
        }
Esempio n. 12
0
 public override double getMetabolicWater(Colony colony, int time)
 {
     return(getRequiredCO(colony, time) / 44 * 18);
 }
Esempio n. 13
0
 public override float getUptakeDeathRate(Colony colony, double co, double water, double n, int time)
 {
     return(0.8f);
 }
Esempio n. 14
0
 public abstract StepRes execute(PlanetCondition conditions, Colony colony);
Esempio n. 15
0
 public override float getRadiationDeathRate(PlanetCondition contitions, Colony colony)
 {
     return(0.9f);
 }
Esempio n. 16
0
 public override double getPlanetN(PlanetCondition contitions, Colony colony, double requiredN)
 {
     throw new NotImplementedException();
 }
Esempio n. 17
0
 public override double getMetabolicWater(Colony colony, int time)
 {
     return(1);
 }
Esempio n. 18
0
 public override double getRequiredN(Colony colony, int time)
 {
     return(colony.getNFixPower() * colony.getMass() * time);
 }
Esempio n. 19
0
 public abstract float getRadiationDeathRate(PlanetCondition contitions, Colony colony);
Esempio n. 20
0
 public override double getPlanetWater(PlanetCondition conditions, Colony colony, double requiredWater)
 {
     return(requiredWater * getPlanetCoe(colony.getMass()));
 }
Esempio n. 21
0
 public abstract float getTemperatureDeathRate(PlanetCondition contitions, Colony colony);
Esempio n. 22
0
 public abstract double getPlanetWater(PlanetCondition contitions, Colony colony, double requiredWater);
Esempio n. 23
0
 public abstract double getPlanetN(PlanetCondition contitions, Colony colony, double requiredN);
Esempio n. 24
0
 private double GetRadiationResistance(model.Colony colonyInfo)
 {
     return(System.Math.Round(colonyInfo.getRadiationResistent(), 5));
 }
Esempio n. 25
0
 public abstract double getRequiredN(Colony colony, int time);
Esempio n. 26
0
 private double GetMaxSize(model.Colony colonyInfo)
 {
     return(colonyInfo.getCellSize());
 }
Esempio n. 27
0
 public abstract double getMetabolicWater(Colony colony, int time);
Esempio n. 28
0
 private double GetNitrogenPower(model.Colony colonyInfo)
 {
     return(System.Math.Round(colonyInfo.getNFixPower(), 5));
 }
Esempio n. 29
0
 public override float getTemperatureDeathRate(PlanetCondition contitions, Colony colony)
 {
     return(0.6f);
 }