Esempio n. 1
0
        private static WordInfo GenerateTail(bool jp, WordInfo body)
        {
            bool failed = true;
            int  row    = body.Row;
            int  column = body.Column;

            for (int i = 0; i < 100; ++i)
            {
                row = wordTable.GetRandomRow();
                if (row == body.Row)
                {
                    continue;
                }
                var record = wordTable.GetRecord(row);
                if (record.Category == body.Category &&
                    record.Category != "万能" && body.Category != "万能")
                {
                    continue;
                }
                column = (column < 10 ? 0 : 10) + HSPRNG.Rnd(2);
                if (record.Get(column) != "")
                {
                    failed = false;
                    break;
                }
            }

            if (failed)
            {
                return(null);
            }

            var word = wordTable.GetRecord(row).Get(column);

            if (!ValidateLength(word))
            {
                return(null);
            }

            return(new WordInfo(word, null, 0, 0));
        }
Esempio n. 2
0
        private static WordInfo GenerateBody(bool jp, WordInfo head)
        {
            int    column = head.Column;
            string word   = "";

            if (jp)
            {
                switch (column)
                {
                case 10:
                case 11:
                    if (HSPRNG.Rnd(5) == 0)
                    {
                        column = 0;
                        if (HSPRNG.Rnd(2) == 0)
                        {
                            word = "の";
                        }
                    }
                    else
                    {
                        switch (HSPRNG.Rnd(5))
                        {
                        case 0:
                            word = "・オブ・";
                            break;

                        case 1:
                            return(new WordInfo("ザ・", null, 0, 0, true));

                        case 2:
                            word = "・";
                            break;

                        default:
                            break;
                        }
                    }
                    break;

                case 0:
                case 1:
                    word = "の";
                    if (HSPRNG.Rnd(10) == 0)
                    {
                        column = 10;
                    }
                    break;

                default:
                    break;
                }
            }
            else
            {
                switch (column)
                {
                case 0:
                case 1:
                    if (HSPRNG.Rnd(6) == 0)
                    {
                        word = " of";
                    }
                    else
                    {
                        if (HSPRNG.Rnd(6) == 0)
                        {
                            return(new WordInfo("The ", null, 0, 0, true));
                        }
                    }
                    break;

                default:
                    word = " ";
                    break;
                }
            }

            return(new WordInfo(word, head.Category, head.Row, column));
        }