Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AssemblyCSharp.Scripts.EntLogic.SerializationObjects.LeftStatement"/> class.
        /// </summary>
        public LeftStatement()
        {
            double nextDouble = CommonHelperMethods.GetRandomDouble0To1();

            if (nextDouble < 0.5)
            {
                MethodSignature signature = RegistrationManager.SelectLeftMethodAtRandom();
                this.leftMethodCall = new LeftMethodCall(signature);
            }
            else
            {
                this.assignment = new Assignment();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Will possibly mutate this section of logic.
        /// </summary>
        public void PossiblyMutate()
        {
            if (GeneticLogicRoot.RollMutateDice())
            {
                MethodSignature signature = RegistrationManager.SelectLeftMethodAtRandom();
                this.leftMethodCall = new LeftMethodCall(signature);
                this.assignment     = null;
                return;
            }

            if (GeneticLogicRoot.RollMutateDice())
            {
                this.leftMethodCall = null;
                this.assignment     = new Assignment();
                return;
            }

            // Note: Method calls and variables are possibly replaced, but not themselves mutated.
            if (this.assignment != null)
            {
                this.assignment.PossiblyMutate();
            }
        }