예제 #1
0
        private void GaussianMutation()
        {
            var colourOrPosition = RandomMutation.RandomIntervalIntegerInclusive(0, 1);

            switch (colourOrPosition)
            {
            case 0:
                ColourShape.GaussianMutation();
                break;

            case 1:
                MutatePosition();
                break;
            }
        }
예제 #2
0
        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);
        }
예제 #3
0
    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);
        }
    }
예제 #4
0
 private void HardMutation()
 {
     ColourShape.HardMutation();
     MutatePosition();
 }