60 lines
1.1 KiB
Java
60 lines
1.1 KiB
Java
package Domain;
|
|
|
|
public class Yatzy_Sheet {
|
|
private int[] tabelle = new int[15];
|
|
|
|
public Yatzy_Sheet(){
|
|
|
|
}
|
|
|
|
public void addScore(int categoryNumber, int score){
|
|
for(int i = 0; i < 14; i++){
|
|
if(i == categoryNumber){
|
|
tabelle[i] = score;
|
|
}
|
|
}
|
|
}
|
|
|
|
//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;
|
|
}
|
|
|
|
//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;
|
|
}
|
|
|
|
public int[] getTabelle(){
|
|
return tabelle;
|
|
}
|
|
}
|