Lauren Green 6 лет назад
Родитель
Сommit
12576f7c77

+ 0
- 3
src/main/java/io/zipcoder/casino/Dice.java Просмотреть файл

@@ -14,7 +14,4 @@ public class Dice {
14 14
         return value;
15 15
     }
16 16
 
17
-    public int getValue() {
18
-        return value;
19
-    }
20 17
 }

+ 14
- 0
src/main/java/io/zipcoder/casino/DicePlayer.java Просмотреть файл

@@ -10,4 +10,18 @@ public class DicePlayer {
10 10
     public DicePlayer(Player player){
11 11
         this.player = player;
12 12
     }
13
+
14
+    public ScoreSheet getScoreSheet() {
15
+        return scoreSheet;
16
+    }
17
+
18
+    public Dice[] getCup() {
19
+        return cup;
20
+    }
21
+
22
+    public void printCup() {
23
+        for(Dice d : cup) {
24
+            System.out.print(d.getValue() + " ");
25
+        }
26
+    }
13 27
 }

+ 22
- 2
src/main/java/io/zipcoder/casino/Yahtzee.java Просмотреть файл

@@ -1,11 +1,17 @@
1 1
 package io.zipcoder.casino;
2 2
 
3 3
 public class Yahtzee extends DiceGame implements Game{
4
+
4 5
     private Dice[] cup;
6
+    DicePlayer dicePlayer;
5 7
 
8
+    public Yahtzee(Player player) {
9
+        this.dicePlayer = new DicePlayer(player);
10
+    }
6 11
 
7 12
     public void compareScore(DicePlayer player1, DicePlayer player2){
8 13
 
14
+        player1.getScoreSheet().getTotalScore();
9 15
     }
10 16
 
11 17
     public void reRoll(){
@@ -23,11 +29,25 @@ public class Yahtzee extends DiceGame implements Game{
23 29
 
24 30
     }
25 31
 
26
-    public void StartGame() {
32
+    public void StartGame(DicePlayer dicePlayer) {
33
+        Dice dice1 = new Dice();
34
+        Dice dice2 = new Dice();
35
+        Dice dice3 = new Dice();
36
+        Dice dice4 = new Dice();
37
+        Dice dice5 = new Dice();
38
+
39
+        dicePlayer.getCup()[0] = dice1;
40
+        dicePlayer.getCup()[1] = dice2;
41
+        dicePlayer.getCup()[2] = dice3;
42
+        dicePlayer.getCup()[3] = dice4;
43
+        dicePlayer.getCup()[4] = dice5;
27 44
 
28 45
     }
29 46
 
30 47
     public void StartRound() {
31
-
48
+        for(Dice d : dicePlayer.getCup()) {
49
+            d.roll();
50
+        }
51
+        dicePlayer.printCup();
32 52
     }
33 53
 }