Fix pointer bug
This commit is contained in:
parent
f6c0f93c7d
commit
f6cfb5794a
@ -11,6 +11,7 @@ public class DiceCup{
|
||||
|
||||
MyDie die;
|
||||
|
||||
for (int i = 0; i <3; i++){
|
||||
if (Dx == 8){
|
||||
die = new EightDie();
|
||||
}
|
||||
@ -18,7 +19,6 @@ public class DiceCup{
|
||||
die = new SixDie();
|
||||
}
|
||||
|
||||
for (int i = 0; i <3; i++){
|
||||
dice.add(die);
|
||||
}
|
||||
}
|
||||
@ -49,16 +49,7 @@ public class DiceCup{
|
||||
|
||||
}
|
||||
public void updateCredits(){
|
||||
if (enoughCredits()){
|
||||
creditBalance -=1;
|
||||
checkTriplets();
|
||||
checkDouble();
|
||||
checkLarge();
|
||||
|
||||
}
|
||||
else{
|
||||
System.out.println("You do not have enough credits! \n");
|
||||
}
|
||||
}
|
||||
|
||||
public boolean enoughCredits(){
|
||||
@ -73,6 +64,7 @@ public class DiceCup{
|
||||
public void testRoll(int [] values){
|
||||
//roll dice until desired 3 int array happens
|
||||
if (enoughCredits()){
|
||||
updateCredits();
|
||||
for (int i =0; i<dice.size(); i++){
|
||||
while (dice.get(i).getValue() != values[i]){
|
||||
dice.get(i).roll();
|
||||
|
Loading…
x
Reference in New Issue
Block a user