private void GaussianMutation() { var colourOrPosition = RandomMutation.RandomIntervalIntegerInclusive(0, 1); switch (colourOrPosition) { case 0: ColourShape.GaussianMutation(); break; case 1: MutatePosition(); break; } }
public ShapeChromosome CloneShapeChromosome() { var shape = new ShapeChromosome(_shapeType) { PositionsShape = new List <PositionDNA>(), ColourShape = (ColourDNA)ColourShape.CloneDNA() }; foreach (var position in PositionsShape) { shape.PositionsShape.Add((PositionDNA)position.CloneDNA()); } return(shape); }
void GenerateCubes() { foreach (GameObject go in Cubes) { Destroy(go); } Cubes.Clear(); for (int i = 0; i < CubeCount; ++i) { Vector3 shapePos = new Vector3(Mathf.Sin(Mathf.PI * 2.0f * i / CubeCount), 0.0f, Mathf.Cos(Mathf.PI * 2.0f * i / CubeCount)); shapePos *= Radius; Quaternion shapeRot = Quaternion.AngleAxis(360.0f * i / CubeCount, Vector3.up); ColourShape shape = Instantiate(CubePrefab, shapePos, shapeRot, transform).GetComponent <ColourShape>(); shape.SetValues(i, CubeCount); } }
private void HardMutation() { ColourShape.HardMutation(); MutatePosition(); }