// copy constructor
        public SimpleBehaviorAggregate(SimpleBehaviorAggregate old)
        {
            this.divideBehavior = new SimpleDivide(old.divideBehavior);
            this.deathBehavior = new SimpleDeathBehavior(old.deathBehavior);

            this.pressureToleranceAtLocation = new SimplePressureToleranceAtLocation(old.pressureToleranceAtLocation);
            this.pressureToleranceAtNeighbors = new SimplePressureToleranceAtNeighbors(old.pressureToleranceAtNeighbors);

            this.foodConsumptionBehavior = new SimpleFoodConsumptionRate(old.foodConsumptionBehavior);
            this.foodMaxStorage = new SimpleFoodMaxStorage(old.foodMaxStorage);
            this.foodConcern = new SimpleFoodConcern(old.foodConcern);

            this.moveAbility = new SimpleMove(old.moveAbility);

            this.pipeEnter = new SimplePipeEnter(old.pipeEnter);
            this.pipeLeave = new SimplePipeLeave(old.pipeLeave);
            this.pipeSurvival = new SimplePipeSurvival(old.pipeSurvival);

            this.callPipeProbability = new SimpleCallPipe(old.callPipeProbability);
        }
Пример #2
0
 public SimplePipeEnter(SimplePipeEnter old)
     : base(old.CurrValue)
 {
 }
        public SimpleBehaviorAggregate(SimulationParameters.SimpleBehaviorParam startingValues)
        {
            if (startingValues.startingDivideRate == 0)
                Console.WriteLine("possible invalid divide rate param");
            divideBehavior = new SimpleDivide(startingValues.startingDivideRate);
            SimpleDivide.MaxValue = 1.0;
            SimpleDivide.MinValue = 0.0;

            if (startingValues.startingDeathRate == 0)
                Console.WriteLine("possible invalid death rate param");
            deathBehavior = new SimpleDeathBehavior(startingValues.startingDeathRate);
            SimpleDeathBehavior.MaxValue = 1.0;
            SimpleDeathBehavior.MinValue = 0.0;

            if (startingValues.startingPressureToleranceAtLocation == 0)
                Console.WriteLine("possible invalid pressure tol @ location param");
            pressureToleranceAtLocation = new SimplePressureToleranceAtLocation(startingValues.startingPressureToleranceAtLocation);
            SimplePressureToleranceAtLocation.MaxValue = SimulationCore.Instance.SimulationParams.cellParameters.MaxPressureToleranceAtLocation;
            SimplePressureToleranceAtLocation.MinValue = SimulationCore.Instance.SimulationParams.cellParameters.MinPressureToleranceAtLocation;

            if (startingValues.startingPressureToleranceAtNeighbors == 0)
                Console.WriteLine("possible invalid perssure tol @ neighbors param");
            pressureToleranceAtNeighbors = new SimplePressureToleranceAtNeighbors(startingValues.startingPressureToleranceAtNeighbors);
            SimplePressureToleranceAtNeighbors.MaxValue = SimulationCore.Instance.SimulationParams.cellParameters.MaxPressureToleranceAtNeighbors;
            SimplePressureToleranceAtNeighbors.MinValue = SimulationCore.Instance.SimulationParams.cellParameters.MinPressureToleranceAtNeighbors;

            if (startingValues.FoodConsumptionRate == 0)
                Console.WriteLine("possible inavlid food consumption rate param");
            foodConsumptionBehavior = new SimpleFoodConsumptionRate(startingValues.FoodConsumptionRate);
            SimpleFoodConsumptionRate.MaxValue = SimulationCore.Instance.SimulationParams.cellParameters.MaxFoodConsumptionRate;
            SimpleFoodConsumptionRate.MinValue = SimulationCore.Instance.SimulationParams.cellParameters.MinFoodConsumptionRate;

            if (startingValues.FoodMaxStorage == 0)
                Console.WriteLine("possible invalid food max storage rate param");
            foodMaxStorage = new SimpleFoodMaxStorage(startingValues.FoodMaxStorage);
            SimpleFoodMaxStorage.MaxValue = SimulationCore.Instance.SimulationParams.cellParameters.MaxFoodStorage;
            SimpleFoodMaxStorage.MinValue = SimulationCore.Instance.SimulationParams.cellParameters.MinFoodStorage;

            if (startingValues.FoodConcernLevel == 0)
                Console.WriteLine("possible invalid food concern lvl param");
            foodConcern = new SimpleFoodConcern(startingValues.FoodConcernLevel);
            SimpleFoodConcern.MaxValue = SimulationCore.Instance.SimulationParams.cellParameters.MaxFoodConcernLevel;
            SimpleFoodConcern.MinValue = SimulationCore.Instance.SimulationParams.cellParameters.MinFoodConcernLevel;

            //if (startingValues.MoveProbability == 0)
            //    Console.WriteLine("possible invalid move probablity param");
            moveAbility = new SimpleMove(startingValues.MoveProbability);
            SimpleMove.MaxValue = 1.0;
            SimpleMove.MinValue = 0.0;

            pipeEnter = new SimplePipeEnter(startingValues.EnterPipeProbability);
            SimplePipeEnter.MaxValue = 1.0;
            SimplePipeEnter.MinValue = 0.0;

            pipeLeave = new SimplePipeLeave(startingValues.LeavePipeProbability);
            SimplePipeLeave.MaxValue = 1.0;
            SimplePipeLeave.MinValue = 0.0;

            pipeSurvival = new SimplePipeSurvival(startingValues.SurvivePipeProbability);
            SimplePipeSurvival.MaxValue = 1.0;
            SimplePipeSurvival.MinValue = 0.0;

            callPipeProbability = new SimpleCallPipe(startingValues.CallPipeProbability);
            SimpleCallPipe.MaxValue = 1.0;
            SimpleCallPipe.MinValue = 0.0;
        }