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