public void CopyBodyGenomeFromTemplate(BodyGenome templateGenome) { testModuleGenome = new TestModuleGenome(templateGenome.testModuleGenome); /* * // This method creates a clone of the provided BodyGenome - should have no shared references!!! * bodyType = templateGenome.bodyType; * // copy module lists: * healthModuleList = new List<HealthGenome>(); * for (int i = 0; i < templateGenome.healthModuleList.Count; i++) { * HealthGenome genomeCopy = new HealthGenome(templateGenome.healthModuleList[i]); * healthModuleList.Add(genomeCopy); * } * oscillatorInputList = new List<OscillatorGenome>(); * for (int i = 0; i < templateGenome.oscillatorInputList.Count; i++) { * OscillatorGenome genomeCopy = new OscillatorGenome(templateGenome.oscillatorInputList[i]); * oscillatorInputList.Add(genomeCopy); * } * valueInputList = new List<ValueInputGenome>(); * for (int i = 0; i < templateGenome.valueInputList.Count; i++) { * ValueInputGenome genomeCopy = new ValueInputGenome(templateGenome.valueInputList[i]); * valueInputList.Add(genomeCopy); * } */ }
public TestModuleGenome(TestModuleGenome template) { this.parentID = template.parentID; this.inno = template.inno; this.maxSpeed = template.maxSpeed; this.accel = template.accel; this.radius = template.radius; }
public TestModuleGenome(TestModuleGenome template) { parentID = template.parentID; inno = template.inno; maxSpeed = template.maxSpeed; accel = template.accel; radius = template.radius; }
public void Initialize(TestModuleGenome genome, Agent agent, StartPositionGenome startPos) { //destroyed = false; bias = new float[1]; bias[0] = 1f; ownPosX = new float[1]; ownPosX[0] = startPos.agentStartPosition.x; ownPosY = new float[1]; ownPosY[0] = startPos.agentStartPosition.y; ownVelX = new float[1]; ownVelY = new float[1]; enemyPosX = new float[1]; enemyPosY = new float[1]; enemyVelX = new float[1]; enemyVelY = new float[1]; enemyDirX = new float[1]; enemyDirY = new float[1]; distLeft = new float[1]; distRight = new float[1]; distUp = new float[1]; distDown = new float[1]; throttleX = new float[1]; throttleY = new float[1]; maxSpeed = genome.maxSpeed; accel = genome.accel; radius = genome.radius; //maxHealth = genome.maxHealth; //health = maxHealth; //prevHealth = health; parentID = genome.parentID; inno = genome.inno; //isVisible = agent.isVisible; //component = agent.segmentList[parentID].AddComponent<HealthModuleComponent>(); //if (component == null) { // Debug.LogAssertion("No existing HealthModuleComponent on segment " + parentID.ToString()); //} //component.healthModule = this; }
public void Initialize(TestModuleGenome genome, Agent agent, StartPositionGenome startPos) { ownRigidBody2D = agent.GetComponent <Rigidbody2D>(); bias = new float[1]; //0 foodPosX = new float[1]; //1 foodPosY = new float[1]; // 2 foodDirX = new float[1]; // 3 foodDirY = new float[1]; // 4 foodTypeR = new float[1]; // 5 foodTypeG = new float[1]; // 6 foodTypeB = new float[1]; // 7 friendPosX = new float[1]; // 8 friendPosY = new float[1]; // 9 friendVelX = new float[1]; // 10 friendVelY = new float[1]; // 11 friendDirX = new float[1]; // 12 friendDirY = new float[1]; // 13 enemyPosX = new float[1]; // 14 enemyPosY = new float[1]; // 15 enemyVelX = new float[1]; // 16 enemyVelY = new float[1]; // 17 enemyDirX = new float[1]; // 18 enemyDirY = new float[1]; // 19 ownVelX = new float[1]; // 20 ownVelY = new float[1]; // 21 temperature = new float[1]; // 22 pressure = new float[1]; // 23 isContact = new float[1]; // 24 contactForceX = new float[1]; // 25 contactForceY = new float[1]; // 26 hitPoints = new float[1]; // 27 stamina = new float[1]; // 28 foodAmountR = new float[1]; // 29 foodAmountG = new float[1]; // 30 foodAmountB = new float[1]; // 31 distUp = new float[1]; // 32 // start up and go clockwise! distTopRight = new float[1]; // 33 distRight = new float[1]; // 34 distBottomRight = new float[1]; // 35 distDown = new float[1]; // 36 distBottomLeft = new float[1]; // 37 distLeft = new float[1]; // 38 distTopLeft = new float[1]; // 39 inComm0 = new float[1]; // 40 inComm1 = new float[1]; // 41 inComm2 = new float[1]; // 42 inComm3 = new float[1]; // 43 // 44 Total Inputs throttleX = new float[1]; // 0 throttleY = new float[1]; // 1 dash = new float[1]; // 2 outComm0 = new float[1]; // 3 outComm1 = new float[1]; // 4 outComm2 = new float[1]; // 5 outComm3 = new float[1]; // 6 // 7 Total Outputs //maxHealth = genome.maxHealth; //health = maxHealth; //prevHealth = health; bias[0] = 1f; foodAmountR[0] = 0.5f; foodAmountG[0] = 0.5f; foodAmountB[0] = 0.5f; hitPoints[0] = 1f; stamina[0] = 1f; //if(genome!= null) { // Debug.Log("!null -- genome.parentID" + genome.parentID.ToString()); //} //Debug.Log("genome.parentID" + genome.parentID.ToString()); parentID = genome.parentID; inno = genome.inno; //isVisible = agent.isVisible; //component = agent.segmentList[parentID].AddComponent<HealthModuleComponent>(); //if (component == null) { // Debug.LogAssertion("No existing HealthModuleComponent on segment " + parentID.ToString()); //} //component.healthModule = this; }
public void InitializeGenomeAsDefault() { testModuleGenome = new TestModuleGenome(0, 0); }