Esempio n. 1
0
 public Animal(Animal mother, double startEnergy, AnimalManager animalManager)
 {
     brain              = new NeuralNetwork(mother.brain);
     this.pos           = mother.pos;
     this.color         = MutateColor(mother.color);
     this.rotation      = mother.rotation + (float)Simulation.NextRandomDouble() * 4 - 2f;
     energy             = startEnergy;
     this.animalManager = animalManager;
     this.Id            = animalManager.GetNextId();
     this.Generation    = mother.Generation + 1;
     this.ParentId      = mother.Id;
 }
Esempio n. 2
0
 public Animal(Vector2 pos, AnimalManager animalManager)
 {
     brain              = new NeuralNetwork(new int[] { NUMNEURONIN + feelerPos.Length * NUMNEURONINPERFEELER + NUMNEURONMEMORY, 20, NUMNEURONOUT + NUMNEURONMEMORY });
     this.pos           = pos;
     this.color         = new Color((float)Simulation.NextRandomDouble(), (float)Simulation.NextRandomDouble(), (float)Simulation.NextRandomDouble());
     this.rotation      = (float)(Simulation.NextRandomDouble() * Math.PI * 2);
     energy             = INITIALENERGY;
     this.animalManager = animalManager;
     this.Id            = animalManager.GetNextId();
     this.Generation    = 0;
     this.ParentId      = AnimalManager.IDNONE;
 }