小编MM-*_*uce的帖子

德州扑克认出了一对

我的程序在首次检查两对之后才识别出一对,我遇到了问题.首先检查一对时它发现没问题.但是当我首先检查这两对时,检查一对它找不到它.任何帮助,将不胜感激.

package card.game.simulator;

import java.util.ArrayList;

public class RankingUtility {
private RankingEnum rank;

public String getRankOfHand(ArrayList<Card> hand) {
    System.out.printf("%s\n", hand.toString());
    ArrayList<Card> rankingCards = getTwoPair(hand);
    if(rankingCards != null) {
        return "Two Pair!";
    }
    System.out.printf("%s\n", hand.toString());
    rankingCards = getOnePair(hand);
    if(rankingCards != null) {
        return "One Pair!";
    }
    System.out.printf("%s\n", hand.toString());
    return "You got nuthin...";
}

public boolean isSameSuit(ArrayList<Card> hand) {
    CardSuitEnum suit = hand.get(0).getSuit();
    for(Card card : hand) {
        if(card.getSuit() != suit) {
            return false;
        }
    }
    return true;
}

public ArrayList<Card> checkPair(ArrayList<Card> hand) …
Run Code Online (Sandbox Code Playgroud)

java poker arraylist

3
推荐指数
1
解决办法
286
查看次数

标签 统计

arraylist ×1

java ×1

poker ×1