Guest User

Untitled

a guest
Jan 23rd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.04 KB | None | 0 0
  1.  
  2. import bowling.*;
  3.  
  4. // Vi har bare én bane: Vi hadde ikke råd til mer.
  5. public class Bowling extends Game {
  6.    
  7.     String[] playerNames = new String[10];
  8.     BowlingBane bowlingBane;
  9.     ScoreCard scoreCard;
  10.     SentralSystem sentral;
  11.    
  12.     public static void main(String[] args) {
  13.        
  14.         // Hent inn playernames
  15.         Scanner sc = new Scanner(new InputStreamReader(System.in));
  16.         int players = 0;
  17.         String player = "";
  18.         while ((player = sc.nextLine()) != null)
  19.             playerNames[players++] = player;
  20.        
  21.         // Start opp bowlingbanen og scorecardsystemet
  22.         bowlingBane = new BowlingBane(playerNames, BowlingBane.DISCO);
  23.         card = new ScoreCard(bowlingBane.getId());
  24.        
  25.         // Game ON!
  26.         bowlingBane.start();
  27.         while (!bowlingBane.gameOver()) {
  28.             if (bowlingBane.checkPins() == BowlingBane.PINS_DOWN) {
  29.                 bowlingBane.reset();
  30.                 scoreCard.logScores(bowlingBane.getRoundScores());
  31.             }
  32.         }
  33.        
  34.         // Send scores til sentralsystemet (singleton)
  35.         SentralSystem.instance().offerScores(scoreCard.getScores());
  36.         bowlingBane.reset();
  37.         System.exit();
  38.     }
  39. }
Add Comment
Please, Sign In to add comment