Exemplo n.º 1
0
        public Carnivore(Random rng, Position pos = null, IAnimalParams customParameters = null) : base(rng, pos)
        {
            if (customParameters is null)
            {
                Params = new CarnivoreParams();
            }
            else
            {
                Params = customParameters;
            }
            var norm = new MathNet.Numerics.Distributions.Normal(Params.BirthWeight, Params.BirthSigma);

            Weight = norm.Sample();
        }
Exemplo n.º 2
0
 public void OverloadParameters(int index, string type, IAnimalParams parameters)
 {
     if (type.ToUpper() == "HERBIVORE" || type.ToUpper() == "H")
     {
         if (parameters.GetType().Name != "HerbivoreParams")
         {
             throw new Exception($"Wrong Parameter type ({parameters.GetType()}) for Herbivore");
         }
         Herbivores[index].Params = parameters;
         return;
     }
     if (type.ToUpper() == "CARNIVORE" || type.ToUpper() == "C")
     {
         if (parameters.GetType().Name != "CarnivoreParams")
         {
             throw new Exception($"Wrong Parameter type ({parameters.GetType()}) for Carnivore");
         }
         Carnivores[index].Params = parameters;
         return;
     }
     throw new Exception($"Unable to overload parameters. \nInput was: INDEX - {index} TYPE - {type} PARAMETERS - {parameters}");
 }
Exemplo n.º 3
0
        public void OverloadParameters(IAnimal animal, IAnimalParams parameters)
        {
            int writemorecodehere;

            animal.Params = parameters;
        }