2024-05-02 11:26:21 +02:00
|
|
|
package Domain;
|
|
|
|
|
|
|
|
import java.util.Random;
|
|
|
|
|
|
|
|
public class Dice {
|
|
|
|
private int numberOfDice;
|
2024-05-03 12:22:01 +02:00
|
|
|
private int[] values;
|
|
|
|
private Random random;
|
2024-05-02 11:26:21 +02:00
|
|
|
|
|
|
|
public Dice(int numberOfDice){
|
|
|
|
this.numberOfDice = numberOfDice;
|
2024-05-03 12:22:01 +02:00
|
|
|
this.values = new int[5];
|
|
|
|
this.random = new Random();
|
2024-05-02 11:26:21 +02:00
|
|
|
}
|
|
|
|
|
2024-05-03 12:22:01 +02:00
|
|
|
public void rollDice(int numberOfDice){
|
|
|
|
for(int i = 0; i < values.length; i++){
|
|
|
|
values[i] = random.nextInt(6) + 1;
|
|
|
|
}
|
2024-05-02 11:26:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public int getAugenzahl(){
|
|
|
|
return numberOfDice;
|
|
|
|
}
|
2024-05-03 12:22:01 +02:00
|
|
|
|
|
|
|
public int getValue(int index){
|
|
|
|
return values[index];
|
|
|
|
}
|
|
|
|
|
|
|
|
public int[] getValues(){
|
|
|
|
return values;
|
|
|
|
}
|
2024-05-02 11:26:21 +02:00
|
|
|
}
|