34 lines
603 B
Java
34 lines
603 B
Java
package Domain;
|
|
|
|
public class Ones extends Category{
|
|
|
|
private Player player;
|
|
|
|
public Ones(Player player) {
|
|
super("Ones", "Score of all the ones rolled.");
|
|
this.player = player;
|
|
}
|
|
|
|
@Override
|
|
public boolean correctCategory(int[] values){
|
|
for(int i : values){
|
|
if(i == 1){
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public int getScore(int[] values){
|
|
int score = 0;
|
|
for (int i : values) {
|
|
if (i == 1) {
|
|
score += 1;
|
|
}
|
|
}
|
|
return score;
|
|
}
|
|
|
|
}
|