Example #1
0
        public void PossiblyMutate()
        {
            if (GeneticLogicRoot.RollMutateDice())
            {
                this.conditionalLeftStatement = new ConditionalLeftStatement(1);
                this.leftStatement            = null;
                return;
            }

            if (GeneticLogicRoot.RollMutateDice())
            {
                this.conditionalLeftStatement = null;
                this.leftStatement            = new LeftStatement(1);
                return;
            }

            if (this.conditionalLeftStatement != null)
            {
                this.conditionalLeftStatement.PossiblyMutate();
            }

            if (this.leftStatement != null)
            {
                this.leftStatement.PossiblyMutate();
            }
        }
Example #2
0
        /// <summary>
        /// Initializes a new instance of the
        /// <see cref="AssemblyCSharp.Scripts.EntLogic.SerializationObjects.ConditionalLeftStatement"/> class.
        /// </summary>
        /// <param name="reader">Reader.</param>
        public ConditionalLeftStatement(FileIOManager reader, int depthIn)
        {
            this.depth = depthIn;

            // Condition block parse
            byte nextByte = reader.ReadByte();

            if (nextByte == StatementTypeEnum.Condition)
            {
                this.condition = new Condition(reader, depthIn + 1);
            }
            else
            {
                CommonHelperMethods.ThrowStatementParseException(
                    nextByte,
                    reader,
                    StatementTypeEnum.Condition);
            }

            // LeftStatement block parse
            nextByte = reader.ReadByte();
            if (nextByte == StatementTypeEnum.LeftStatement)
            {
                this.leftStatement = new LeftStatement(reader, depthIn + 1);
            }
            else
            {
                CommonHelperMethods.ThrowStatementParseException(
                    nextByte,
                    reader,
                    StatementTypeEnum.LeftStatement);
            }
        }
Example #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AssemblyCSharp.Scripts.EntLogic.SerializationObjects.RootStatement"/> class.
        /// </summary>
        public RootStatement()
        {
            int value = CommonHelperMethods.GetRandomPositiveInt0ToValue(1);

            if (value == 0)
            {
                this.conditionalLeftStatement = new ConditionalLeftStatement(1);
            }
            else
            {
                this.leftStatement = new LeftStatement(1);
            }
        }
Example #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AssemblyCSharp.Scripts.EntLogic.SerializationObjects.RootStatement"/> class.
        /// </summary>
        /// <param name="reader">A StreamReader pointed to line where this RootStatement begins.</param>
        public RootStatement(FileIOManager reader)
        {
            byte nextByte = reader.ReadByte();

            if (nextByte == StatementTypeEnum.ConditionalLeftStatement)
            {
                this.conditionalLeftStatement = new ConditionalLeftStatement(reader, 1);
            }
            else if (nextByte == StatementTypeEnum.LeftStatement)
            {
                this.leftStatement = new LeftStatement(reader, 1);
            }
            else
            {
                CommonHelperMethods.ThrowStatementParseException(
                    nextByte,
                    reader,
                    new List <byte>()
                {
                    StatementTypeEnum.ConditionalLeftStatement,
                    StatementTypeEnum.LeftStatement
                });
            }
        }
Example #5
0
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="AssemblyCSharp.Scripts.EntLogic.SerializationObjects.ConditionalLeftStatement"/> class.
 /// </summary>
 public ConditionalLeftStatement(int depthIn)
 {
     this.depth         = depthIn;
     this.condition     = new Condition(depthIn + 1);
     this.leftStatement = new LeftStatement(depthIn + 1);
 }