public Predator(Texture2D texture, Vector2 position, int size, float mass, float sightRadius, float lateralRadius, NeuralNet neuralNet) : base(texture, position, size, mass, sightRadius, lateralRadius) { this.neuralNet = neuralNet; this.texture = texture; otherPredatorsInSight = new List <MovingAgent>(); otherPredatorsInLateral = new List <MovingAgent>(); }
public Prey(Texture2D texture, Vector2 position, int size, float mass, float sightRadius, float lateralRadius) : base(texture, position, size, mass, sightRadius, lateralRadius) { neuralNet = new NeuralNet(true); //this.texture = texture; localVegetationInSight = new List <Agent>(); localVegetationInLateral = new List <Agent>(); predatorsInSight = new List <MovingAgent>(); predatorsInLateral = new List <MovingAgent>(); }
private void CreateAgentFromCrossover(MovingAgent parentOne, MovingAgent parentTwo, List <Prey> prey, int i) { NeuralNet neuralNetwork = CrossOver(parentOne, parentTwo); int tempX = (int)Utilities.RandomMinMax(0 + Utilities.AgentTextureSize, Utilities.ScreenWidth - Utilities.AgentTextureSize); int tempY = (int)Utilities.RandomMinMax(0 + Utilities.AgentTextureSize, Utilities.ScreenHeight - Utilities.AgentTextureSize); prey[i] = new Prey(preyTexture, new Vector2(tempX, tempY), Utilities.AgentTextureSize, Utilities.Mass, Utilities.SightRadiusPrey, Utilities.LateralLinePrey, neuralNetwork); if (Utilities.RandomMinMax(0, 1) < Utilities.MutationChance) { prey[i].Mutate(); } preyCreatedSoFar++; UpdateGenerationNumber(); }
void Awake() { _neuralNet = new NeuralNet(numOfInput, numOfOutput, numOfHiddenLayers, numOfNeuronsPerHiddenLayer); }
public bool IsSameSetup(NeuralNet other) { return(other._numOfInput == this._numOfInput && other._numOfOutput == this._numOfOutput && other._numHiddenLayers == this._numHiddenLayers && other._numOfNeuronsPerHiddenLayer == this._numOfNeuronsPerHiddenLayer); }