我的全屋方法有问题.我认为这就像检查三种和一对一样简单.但是根据我目前的代码,我得到了一个只有三种类型的满堂红.isFullHouse()的代码isThreeOfAKind()和isPair()在下面感谢所有的帮助!
public boolean isPair() {
Pips[] values = new Pips[5];
int count =0;
//Put each cards numeric value into array
for(int i = 0; i < cards.length; i++){
values[i] = cards[i].getPip();
}
//Loop through the values. Compare each value to all values
//If exactly two matches are made - return true
for(int x = 1; x < values.length; x++){
for(int y = 0; y < x; y++){
if(values[x].equals(values[y])) count++;
}
if (count == 1) return true;
count = 0;
} …Run Code Online (Sandbox Code Playgroud)