Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import bowling.*;
- // Vi har bare én bane: Vi hadde ikke råd til mer.
- public class Bowling extends Game {
- String[] playerNames = new String[10];
- BowlingBane bowlingBane;
- ScoreCard scoreCard;
- SentralSystem sentral;
- public static void main(String[] args) {
- // Hent inn playernames
- Scanner sc = new Scanner(new InputStreamReader(System.in));
- int players = 0;
- String player = "";
- while ((player = sc.nextLine()) != null)
- playerNames[players++] = player;
- // Start opp bowlingbanen og scorecardsystemet
- bowlingBane = new BowlingBane(playerNames, BowlingBane.DISCO);
- card = new ScoreCard(bowlingBane.getId());
- // Game ON!
- bowlingBane.start();
- while (!bowlingBane.gameOver()) {
- if (bowlingBane.checkPins() == BowlingBane.PINS_DOWN) {
- bowlingBane.reset();
- scoreCard.logScores(bowlingBane.getRoundScores());
- }
- }
- // Send scores til sentralsystemet (singleton)
- SentralSystem.instance().offerScores(scoreCard.getScores());
- bowlingBane.reset();
- System.exit();
- }
- }
Add Comment
Please, Sign In to add comment