Ejemplo 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();
        }
Ejemplo 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();
        }
Ejemplo 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);
 }
Ejemplo n.º 4
0
 //public abstract float getSmallCellDeathRate(ColonyStats stats);
 public abstract float getUptakeDeathRate(Colony colony, double co, double water, double n, int time);
Ejemplo n.º 5
0
 public override double getRequiredN(Colony colony, int time)
 {
     return(colony.getMass() * 0.1 * time);
 }
Ejemplo n.º 6
0
 public abstract float getDivRate(Colony colony);
Ejemplo n.º 7
0
 private double GetTemperatureResistance(model.Colony colonyInfo)
 {
     return(colonyInfo.getOptimalTemperature());
 }
Ejemplo n.º 8
0
 private double GetPhotoPower(model.Colony colonyInfo)
 {
     return(System.Math.Round(colonyInfo.getPhotosynthesisPower(), 5));
 }
Ejemplo n.º 9
0
 public override double getRequiredCO(Colony colony, int time)
 {
     return(colony.getPhotosynthesisPower() * colony.getMass() * time);
 }
Ejemplo n.º 10
0
 private double GetTotalMass(model.Colony colonyInfo)
 {
     return(colonyInfo.getMass());
 }
Ejemplo n.º 11
0
        public override double getRequiredWater(Colony colony, int time)
        {
            double metabolism = getMetabolicWater(colony, time);

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