public static void Go(Random random)
        {
            Random rand = random;
            Game aGame = new Game();

            aGame.add("Chet");
            aGame.add("Pat");
            aGame.add("Sue");

            do
            {

                aGame.roll(rand.Next(5) + 1);

                if (rand.Next(9) == 7)
                {
                    notAWinner = aGame.wrongAnswer();
                }
                else
                {
                    notAWinner = aGame.wasCorrectlyAnswered();
                }

            } while (notAWinner);
        }
Beispiel #2
0
        public void RunGame(TextWriter writer, int seed)
        {
            Game aGame = new Game(writer);

            aGame.add("Chet");
            aGame.add("Pat");
            aGame.add("Sue");

            aGame.StartGame();

            Random rand = new Random(seed);

            do
            {
                aGame.roll(rand.Next(5) + 1);

                if (rand.Next(9) == 7)
                {
                    notAWinner = aGame.wrongAnswer();
                }
                else
                {
                    notAWinner = aGame.wasCorrectlyAnswered();
                }
            } while (notAWinner);
        }
Beispiel #3
0
        public static void Main(String[] args)
        {
            Game aGame = new Game();

            aGame.add("Chet");
            aGame.add("Pat");
            aGame.add("Sue");

            Random rand = new Random();

            do
            {

                aGame.roll(rand.Next(5) + 1);

                if (rand.Next(9) == 7)
                {
                    notAWinner = aGame.wrongAnswer();
                }
                else
                {
                    notAWinner = aGame.wasCorrectlyAnswered();
                }

            } while (notAWinner);
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            var game = new Game();
            game.add("Player 1");
            game.add("Player 2");
            game.add("Player 3");
            bool notAWinner;
            Random rand = new Random(1);

            do
            {

                game.roll(rand.Next(5) + 1);

                if (rand.Next(9) == 7)
                {
                    notAWinner = game.wrongAnswer();
                }
                else
                {
                    notAWinner = game.wasCorrectlyAnswered();
                }

            } while (notAWinner);
            Console.Read();
        }
        public static void main(String[] args)
        {
            Game aGame = new Game();

            aGame.add("Chet");
            aGame.add("Pat");
            aGame.add("Sue");

            //Random rand = new Random();       Original Code
            // Creates not random series. Take 4711, 0815, 42, etc. to be time independent
            Random rand = new Random(4711);

            do
            {

                aGame.roll(rand.Next(5) + 1);

                if (rand.Next(9) == 7)
                {
                    notAWinner = aGame.wrongAnswer();
                }
                else
                {
                    notAWinner = aGame.wasCorrectlyAnswered();
                }

            } while (notAWinner);
        }
        public static void PlayTheGame()
        {
            Random rand  = new Random();
            Game   aGame = new Game();

            Console.WriteLine("\n\n--- Trivia Game ---");

            aGame.add("Chet");
            aGame.add("Pat");
            aGame.add("Sue");

            do
            {
                aGame.roll(rand.Next(5) + 1);

                if (rand.Next(9) == 7)
                {
                    notAWinner = aGame.wrongAnswer();
                }
                else
                {
                    notAWinner = aGame.wasCorrectlyAnswered();
                }
            } while (notAWinner);
        }
Beispiel #7
0
        private static void PlayFakeGame()
        {
            var game = new Game();
            game.add("Andreas");
            game.add("Kjersti");
            game.add("Kim");

            bool gameIsrunning = true;

            while (gameIsrunning)
            {
                game.roll(_helper.Throw());

                if (_helper.Answer())
                    gameIsrunning = game.wasCorrectlyAnswered();
                else
                    gameIsrunning = game.wrongAnswer();
            }
            Console.WriteLine("-------------------");
        }
Beispiel #8
0
        public static void Run(Random rand)
        {
            Game aGame = new Game();

            aGame.AddPlayer("Chet");
            aGame.AddPlayer("Pat");
            aGame.AddPlayer("Sue");

            //Random rand = new Random();

            do
            {
                aGame.EvaluateRoll(rand.Next(5) + 1);

                if (rand.Next(9) == 7)
                {
                    notAWinner = aGame.wrongAnswer();
                }
                else
                {
                    notAWinner = aGame.wasCorrectlyAnswered();
                }
            } while (notAWinner);
        }