Package pair.trivia.a20130524.runner

Source Code of pair.trivia.a20130524.runner.GameRunner

package pair.trivia.a20130524.runner;

import pair.trivia.a20130524.CurrentPlayer;
import pair.trivia.a20130524.Game;
import pair.trivia.a20130524.Players;
import pair.trivia.a20130524.Questions;

import java.util.Random;

public class GameRunner {

    public static void main(String[] args) {
        Random rand = new Random();
        play(rand);
    }

    public static void play(Random rand) {

        Players players = new Players();
        players.add("Chet");
        players.add("Pat");
        players.add("Sue");

        CurrentPlayer currentPlayer = new CurrentPlayer(players);

        Questions questions = new Questions();

        Game aGame = new Game(currentPlayer, questions);

        boolean notAWinner;
        do {

            aGame.play(rand.nextInt(5) + 1);

            if (rand.nextInt(9) == 7) {
                notAWinner = aGame.wrongAnswer();
            } else {
                notAWinner = aGame.correctAnswer();
            }

        } while (notAWinner);
       
    }
}
TOP

Related Classes of pair.trivia.a20130524.runner.GameRunner

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.