40 lines
877 B
Java
40 lines
877 B
Java
package Domain;
|
|
|
|
public class Yatzy extends Category{
|
|
|
|
public Yatzy() {
|
|
super("Yatzy", "five times the same dice");
|
|
}
|
|
|
|
@Override
|
|
public boolean correctCategory(int[] values){
|
|
|
|
int one = 0, two = 0, three = 0, four = 0, five = 0;
|
|
for(int i = 0; i < values.length; i++){
|
|
switch(i){
|
|
case 1:
|
|
one += 1;
|
|
case 2:
|
|
two += 1;
|
|
case 3:
|
|
three += 1;
|
|
case 4:
|
|
four += 1;
|
|
case 5:
|
|
five += 1;
|
|
break;
|
|
}
|
|
}
|
|
if(one == 1 && two == 1 && three == 1 && four == 1 && five == 1){
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public int getScore(int[] values){
|
|
return 75;
|
|
}
|
|
}
|