示例#1
0
        public string Generate()
        {
            Random num   = new Random();
            int    index = num.Next(0, 3);

            while (index == numManager.line)
            {
                index = num.Next(0, 3);
            }
            numManager.line = index;
            if (index == 0)
            {
                Noun noun = new Noun(numManager);
                return(noun.Generate());
            }
            if (index == 1)
            {
                Prep prep = new Prep(numManager);
                return(prep.Generate());
            }

            Pronoun pronoun = new Pronoun(numManager);

            return(pronoun.Generate());
        }
示例#2
0
        override public string Generate()
        {
            if (numManager.depth > 5)
            {
                return(base.Generate());
            }
            Random num   = new Random();
            int    index = num.Next(0, 3);

            while (index == numManager.noun_rest)
            {
                index = num.Next(0, 3);
            }
            numManager.noun_rest = index;
            if (index == 0)
            {
                numManager.depth++;
                Verb verb = new Verb(numManager);
                return(base.Generate() + " " + verb.Generate());
            }

            if (index == 1)
            {
                numManager.depth++;
                Prep prep = new Prep(numManager);
                return(base.Generate() + " " + prep.Generate());
            }
            return(base.Generate());
        }