コード例 #1
0
        // pre: none
        // post: a hetrogeneous collection of blurtSkips is in valid inital state
        public static void createBlurtSkip(blurtSkip[] collection, string[] wordBank, int collectionSize)
        {
            Random rnd    = new Random();
            int    start  = 5;
            int    dif    = 10;
            int    num    = 100;
            int    nStart = 20;

            for (int i = 0; i < collectionSize; i++)
            {
                uint a    = (uint)rnd.Next(start);
                uint d    = (uint)rnd.Next(dif);
                uint n    = (uint)rnd.Next(nStart, num);
                int  word = rnd.Next(nStart);
                collection[i] = new blurtSkip(wordBank[word], a, d, n);
            }
        }
コード例 #2
0
        static void Main(string[] args)
        {
            const int bankSize       = 20;
            const int collectionSize = 5;
            const int loopCount      = 40;

            string[] wordBank = new string[bankSize] {
                "dress", "hip", "bless", "acute", "chest", "count", "thin",
                "thick", "belt", "drive", "trace", "bell", "roar", "clear", "sip", "mess", "hover", "ego", "zero"
                , "steep"
            };

            blurtGens[] bGenCollection  = new blurtGens[collectionSize];
            blurtSkip[] bSkipCollection = new blurtSkip[collectionSize];
            blurtDub[]  bDubCollection  = new blurtDub[collectionSize];

            bool run = welcome();

            while (run)
            {
                createBlurtGens(bGenCollection, wordBank, collectionSize);
                createBlurtSkip(bSkipCollection, wordBank, collectionSize);
                createBlurtDub(bDubCollection, wordBank, collectionSize);
                int    count = 0;
                Random rnd   = new Random();

                while (count < loopCount)
                {
                    int i = rnd.Next(collectionSize);
                    printActiveBlurtGen(bGenCollection, i);
                    printActiveBlurtSkip(bSkipCollection, i);
                    printActiveBlurtDub(bDubCollection, i);
                    count++;
                }
                run = runAgain();
            }
            Console.WriteLine("Goodbye...");
        }