2024-05-03 21:10:44 +02:00
|
|
|
package Domain;
|
|
|
|
|
|
|
|
public class ThreePairs extends Category{
|
|
|
|
|
2024-05-03 21:44:06 +02:00
|
|
|
private int one = 0, two = 0, three = 0, four = 0, five = 0;
|
|
|
|
|
|
|
|
public ThreePairs(Player player) {
|
|
|
|
super("Three Pairs", "Three times the same dice");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean correctCategory(int[] values){
|
|
|
|
|
|
|
|
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 == 3 || two == 3 || three == 3 || four == 3 || five == 3){
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getScore(){
|
|
|
|
|
|
|
|
if(one == 4){
|
|
|
|
return 4;
|
|
|
|
}
|
|
|
|
else if(two == 4){
|
|
|
|
return 8;
|
|
|
|
}
|
|
|
|
else if(three == 4){
|
|
|
|
return 12;
|
|
|
|
}
|
|
|
|
else if(four == 4){
|
|
|
|
return 16;
|
|
|
|
}
|
|
|
|
else if(five == 4){
|
|
|
|
return 20;
|
|
|
|
}
|
|
|
|
return 0;
|
2024-05-03 21:10:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|