2024-05-03 12:22:01 +02:00
|
|
|
package Domain;
|
|
|
|
|
|
|
|
public class Yatzy_Sheet {
|
2024-05-06 13:18:10 +02:00
|
|
|
private int[] tabelle = new int[15];
|
2024-05-06 12:28:18 +02:00
|
|
|
|
|
|
|
public Yatzy_Sheet(){
|
|
|
|
|
|
|
|
}
|
2024-05-06 13:18:10 +02:00
|
|
|
|
|
|
|
public void addScore(int categoryNumber, int score){
|
|
|
|
for(int i = 0; i < 14; i++){
|
|
|
|
if(i == categoryNumber){
|
2024-05-06 15:57:22 +02:00
|
|
|
tabelle[i] = score;
|
2024-05-06 13:18:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-05-06 13:44:17 +02:00
|
|
|
//WICHTIG!!!
|
|
|
|
//
|
|
|
|
//Methode für bonuspunkte hinzufügen
|
|
|
|
//
|
|
|
|
//
|
|
|
|
|
|
|
|
public boolean fullArray(){
|
|
|
|
for(int i = 0; i < tabelle.length - 2; i++){
|
|
|
|
if(tabelle[i] > 0){
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2024-05-03 12:22:01 +02:00
|
|
|
//counts all the
|
|
|
|
public int getSumOne(){
|
|
|
|
int sum = 0;
|
|
|
|
for(int i = 0; i < 6; i++){
|
|
|
|
sum += tabelle[i];
|
|
|
|
}
|
|
|
|
return sum;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getSumTwo(){
|
|
|
|
int sum = 0;
|
|
|
|
for (int i = 7; i < 17; i++){
|
|
|
|
sum += tabelle[i];
|
|
|
|
}
|
|
|
|
return sum;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getSum(){
|
|
|
|
int sumOne = getSumOne();
|
|
|
|
int sumTwo = getSumTwo();
|
|
|
|
return sumOne += sumTwo;
|
|
|
|
}
|
2024-05-06 13:44:17 +02:00
|
|
|
|
|
|
|
public int[] getTabelle(){
|
|
|
|
return tabelle;
|
|
|
|
}
|
2024-05-03 12:22:01 +02:00
|
|
|
}
|