Exemple #1
0
        public static void Mutate(this DnaDrawing dnaDrawing)
        {
            if (Tools.WillMutate(Settings.ActiveAddPolygonMutationRate))
            {
                if (dnaDrawing.AddPolygon())
                {
                    dnaDrawing.SetDirty();
                }
            }

            if (Tools.WillMutate(Settings.ActiveRemovePolygonMutationRate))
            {
                if (dnaDrawing.RemovePolygon())
                {
                    dnaDrawing.SetDirty();
                }
            }

            if (Tools.WillMutate(Settings.ActiveMovePolygonMutationRate))
            {
                if (dnaDrawing.MovePolygon())
                {
                    dnaDrawing.SetDirty();
                }
            }

            foreach (DnaPolygon polygon in dnaDrawing.Polygons)
            {
                polygon.Mutate(dnaDrawing);
            }
        }