Ejemplo n.º 1
0
        internal override string Generate(Random random)
        {
            if (this == RECompiler.InvalidNode)
            {
                //select a character
                int pos = random.Next(mNodeText.Length);

                //generate any other character using a negative SetNode
                RESetNode others = new RESetNode(false);
                others.AddChars(mNodeText[pos].ToString());

                //replace the character
                char backup = mNodeText[pos];
                mNodeText[pos] = others.Generate(random)[0];
                string result = mNodeText.ToString();

                //if this node is repeated it needs to be cleaned up for the next call
                mNodeText[pos] = backup;

                return(result);
            }
            else
            {
                return(mNodeText.ToString());
            }
        }