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(); }
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(); }
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); }
//public abstract float getSmallCellDeathRate(ColonyStats stats); public abstract float getUptakeDeathRate(Colony colony, double co, double water, double n, int time);
public override double getRequiredN(Colony colony, int time) { return(colony.getMass() * 0.1 * time); }
public abstract float getDivRate(Colony colony);
private double GetTemperatureResistance(model.Colony colonyInfo) { return(colonyInfo.getOptimalTemperature()); }
private double GetPhotoPower(model.Colony colonyInfo) { return(System.Math.Round(colonyInfo.getPhotosynthesisPower(), 5)); }
public override double getRequiredCO(Colony colony, int time) { return(colony.getPhotosynthesisPower() * colony.getMass() * time); }
private double GetTotalMass(model.Colony colonyInfo) { return(colonyInfo.getMass()); }
public override double getRequiredWater(Colony colony, int time) { double metabolism = getMetabolicWater(colony, time); return(metabolism + colony.getMass()); }
public override double getMetabolicWater(Colony colony, int time) { return(getRequiredCO(colony, time) / 44 * 18); }
public override float getUptakeDeathRate(Colony colony, double co, double water, double n, int time) { return(0.8f); }
public abstract StepRes execute(PlanetCondition conditions, Colony colony);
public override float getRadiationDeathRate(PlanetCondition contitions, Colony colony) { return(0.9f); }
public override double getPlanetN(PlanetCondition contitions, Colony colony, double requiredN) { throw new NotImplementedException(); }
public override double getMetabolicWater(Colony colony, int time) { return(1); }
public override double getRequiredN(Colony colony, int time) { return(colony.getNFixPower() * colony.getMass() * time); }
public abstract float getRadiationDeathRate(PlanetCondition contitions, Colony colony);
public override double getPlanetWater(PlanetCondition conditions, Colony colony, double requiredWater) { return(requiredWater * getPlanetCoe(colony.getMass())); }
public abstract float getTemperatureDeathRate(PlanetCondition contitions, Colony colony);
public abstract double getPlanetWater(PlanetCondition contitions, Colony colony, double requiredWater);
public abstract double getPlanetN(PlanetCondition contitions, Colony colony, double requiredN);
private double GetRadiationResistance(model.Colony colonyInfo) { return(System.Math.Round(colonyInfo.getRadiationResistent(), 5)); }
public abstract double getRequiredN(Colony colony, int time);
private double GetMaxSize(model.Colony colonyInfo) { return(colonyInfo.getCellSize()); }
public abstract double getMetabolicWater(Colony colony, int time);
private double GetNitrogenPower(model.Colony colonyInfo) { return(System.Math.Round(colonyInfo.getNFixPower(), 5)); }
public override float getTemperatureDeathRate(PlanetCondition contitions, Colony colony) { return(0.6f); }