Package dojo.trivia.a20120505cr6.runner

Source Code of dojo.trivia.a20120505cr6.runner.GameRunner

package dojo.trivia.a20120505cr6.runner;

import java.util.Random;

import dojo.trivia.a20120505cr6.Game;


public class GameRunner {

   private static boolean notAWinner;

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

   // reorder sequence
   // extract method
   public static void play(Random rand) {
      Game aGame = new Game();

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

      do {

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

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

      } while (notAWinner);
   }
}
TOP

Related Classes of dojo.trivia.a20120505cr6.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.