Browse Source

Started adding to Yahtzee

Lauren Green 6 years ago
parent
commit
12576f7c77

+ 0
- 3
src/main/java/io/zipcoder/casino/Dice.java View File

14
         return value;
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 View File

10
     public DicePlayer(Player player){
10
     public DicePlayer(Player player){
11
         this.player = player;
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 View File

1
 package io.zipcoder.casino;
1
 package io.zipcoder.casino;
2
 
2
 
3
 public class Yahtzee extends DiceGame implements Game{
3
 public class Yahtzee extends DiceGame implements Game{
4
+
4
     private Dice[] cup;
5
     private Dice[] cup;
6
+    DicePlayer dicePlayer;
5
 
7
 
8
+    public Yahtzee(Player player) {
9
+        this.dicePlayer = new DicePlayer(player);
10
+    }
6
 
11
 
7
     public void compareScore(DicePlayer player1, DicePlayer player2){
12
     public void compareScore(DicePlayer player1, DicePlayer player2){
8
 
13
 
14
+        player1.getScoreSheet().getTotalScore();
9
     }
15
     }
10
 
16
 
11
     public void reRoll(){
17
     public void reRoll(){
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
     public void StartRound() {
47
     public void StartRound() {
31
-
48
+        for(Dice d : dicePlayer.getCup()) {
49
+            d.roll();
50
+        }
51
+        dicePlayer.printCup();
32
     }
52
     }
33
 }
53
 }