|
@@ -6,6 +6,16 @@ public abstract class DiceGame implements Game {
|
6
|
6
|
|
7
|
7
|
private int numOfDice = 2;
|
8
|
8
|
private int[] die = new int[numOfDice];
|
|
9
|
+ private char one = '⚀';
|
|
10
|
+ private char two = '⚁';
|
|
11
|
+ private char three = '⚂';
|
|
12
|
+ private char four = '⚃';
|
|
13
|
+ private char five = '⚄';
|
|
14
|
+ private char six = '⚅';
|
|
15
|
+
|
|
16
|
+ public void displayDice(){
|
|
17
|
+
|
|
18
|
+ }
|
9
|
19
|
|
10
|
20
|
public int rollDice(int numOfDice) {
|
11
|
21
|
int sum = 0;
|
|
@@ -13,9 +23,22 @@ public abstract class DiceGame implements Game {
|
13
|
23
|
for (int i = 0; i < numOfDice; i++) {
|
14
|
24
|
die[i] = (int) Math.floor((Math.random() * 6) + 1);
|
15
|
25
|
sum += die[i];
|
16
|
|
- System.out.println("Die #" + (i+1) + " = " + die[i]);
|
|
26
|
+ if (die[i] == 1) {
|
|
27
|
+ System.out.println(one);
|
|
28
|
+ } else if (die[i] == 2) {
|
|
29
|
+ System.out.println(two);
|
|
30
|
+ } else if (die[i] == 3) {
|
|
31
|
+ System.out.println(three);
|
|
32
|
+ } else if (die[i] == 4) {
|
|
33
|
+ System.out.println(four);
|
|
34
|
+ } else if (die[i] == 5) {
|
|
35
|
+ System.out.println(five);
|
|
36
|
+ } else if (die[i] == 6) {
|
|
37
|
+ System.out.println(six);
|
|
38
|
+ }
|
|
39
|
+
|
|
40
|
+
|
17
|
41
|
}
|
18
|
42
|
return sum;
|
19
|
43
|
}
|
20
|
|
-
|
21
|
|
-}
|
|
44
|
+}
|