Пример #1
0
        static void Main(string[] args)
        {
            randomTargets[] targets = new randomTargets[NUM_OBJ];

            for (int i = 0; i < NUM_OBJ; i++)
            {
                targets[i] = new randomTargets(ARR_SIZE, randomize());
            }

            WriteLine("Welcome to the randomTargets class demonstration!");
            WriteLine("\n");

            WriteLine("In this program, the randomTargets class will be");
            WriteLine("tested using a variety of random numebers in order");
            WriteLine("to guess the internal values that lie within the");
            WriteLine("object.");
            WriteLine("\n");

            WriteLine("Press enter to start the test...");
            ReadKey();

            Clear();

            runTests(targets);

            WriteLine("Press enter to end the program...");
            ReadKey();

            //shows the statistics
            //demonstrate both known and unknown state
        }
Пример #2
0
        /// Returns object with the greatest number of high guess and the object
        /// with the greatest number of low guesses
        ///
        ///
        /// <param name="r"></param>
        static void stats(randomTargets r)
        {
            targetInt temp  = new targetInt(r.findHighGuesses());
            targetInt temp2 = new targetInt(r.findLowGuesses());

            WriteLine("Greatest # of high guesses: Object " + temp.getobjectID());
            WriteLine("--------------------------------------");

            WriteLine("# of guesses: " + temp.getnumGuess());
            WriteLine("# of high guesses: " + temp.gethighGuess());
            WriteLine("# of low guesses: " + temp.getlowGuess());
            WriteLine("Average guess: " + temp.getavgGuess());
            WriteLine("\n");

            WriteLine("Greatest # of low guesses: Object " + temp2.getobjectID());
            WriteLine("--------------------------------------");

            WriteLine("# of guesses: " + temp2.getnumGuess());
            WriteLine("# of high guesses: " + temp2.gethighGuess());
            WriteLine("# of low guesses: " + temp2.getlowGuess());
            WriteLine("Average guess: " + temp2.getavgGuess());
            WriteLine("\n");
        }