コード例 #1
0
ファイル: Prep.cs プロジェクト: hades22/PoemWriter
        override public string Generate()
        {
            Random num   = new Random();
            int    index = num.Next(0, 3);

            while (index == numManager.prep_rest)
            {
                index = num.Next(0, 3);
            }
            numManager.prep_rest = index;
            if (index == 0)
            {
                Noun noun = new Noun(numManager);
                return(base.Generate() + " " + noun.Generate());
            }

            if (index == 1)
            {
                Pronoun pronoun = new Pronoun(numManager);
                return(base.Generate() + " " + pronoun.Generate());
            }

            Adj adj = new Adj(numManager);

            return(base.Generate() + " " + adj.Generate());
        }
コード例 #2
0
ファイル: Line.cs プロジェクト: hades22/PoemWriter
        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());
        }
コード例 #3
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.verb_rest)
            {
                index = num.Next(0, 3);
            }
            numManager.verb_rest = index;
            if (index == 0)
            {
                numManager.depth++;
                Prep prep = new Prep(numManager);
                return(base.Generate() + " " + prep.Generate());
            }

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