关于我的德州扑克扑克结果确定器Java的问题

这是我的代码,大多数变量是局部的。非本地的是:

currentCardValues:包含当前正在评估的玩家的值

currentCardTypes:包含当前正在评估的玩家的纸牌类型(心形,菱形等)。

当前分数:被评估的玩家将获得的分数

我总是得到不正确的结果(有时它们会起作用),但是我无法指出问题所在。帮助将不胜感激。

    public static void straightFlush() {

    //Variables
    boolean isStraightFlush = false;
    boolean flushFound = false;
    boolean straightPossible = true;
    int [] flushCardValues = new int [7];
    int cardType = 0;
    int cardCount = 0;
    int typeAmount = 0;
    int amountCardsToCheck = 5;

    for(cardType=0; cardType<4; cardType++) {

        for(int y=0; y<7; y++) {
            if(currentCardTypes[y]==cardType) {
                typeAmount++;                   
            }   
        }
        if(typeAmount>=5) {
            flushFound=true;
            break;
        }
        typeAmount=0;

    }

    if(flushFound==true) {
        for(int f=0; f<7; f++) {
            if(currentCardTypes[f]==cardType) {
                flushCardValues[cardCount]=currentCardValues[f];
                cardCount++;
            }
        }

        arraySorter(flushCardValues);
        int y=0;
        int f=0;

        for (f=2; f>=0; f--) {
            straightPossible = true;

            for(y=0; y<amountCardsToCheck; y++) {

                //In case there are multiple numbers of the same Value card.
                if(f+y>0) {
                    if(flushCardValues[f+y]==flushCardValues[f+y-1]) {
                        if(f+amountCardsToCheck<7) {
                            amountCardsToCheck++;
                        }
                    }

                    else if(flushCardValues[f]+y==flushCardValues[f+y]) {
                        straightPossible = true;
                    }
                    else {
                        straightPossible = false;
                        break;
                    }
                }

                else if(flushCardValues[f]+y==flushCardValues[f+y]) {
                    straightPossible = true;
                }
                else {
                    straightPossible = false;
                    break;
                }
                amountCardsToCheck = 5;
            }

            if(straightPossible==true) {
                isStraightFlush = true;
                break;
            }               

        }
        if(isStraightFlush==true) {
            currentScore = 800 + flushCardValues[f+y-1];
        }
        else {
            fourOfAKind();
        }

    }


}

public static void fourOfAKind() {
    int amountMatchingCards = 0;
    int quadCardValue = 0;
    boolean isFour = false;

    for(int f=0; f<7;f++) {

        for(int y=0; y<7; y++) {
            if(currentCardValues[f]==currentCardValues[y]) {
                amountMatchingCards++;
            }

        }
        if(amountMatchingCards==4) {
            isFour=true;
            quadCardValue=currentCardValues[f];
            break;
        }
    }
    if(isFour==true) {
        currentScore = 700 + quadCardValue;
    }
    else {
        fullHouse();
    }

}

public static void fullHouse() {
    int triCardValue = 0;
    int pairCardValue = 0;
    boolean isFullHouse = false;


    for(int f=0; f<7;f++) {
        int [] possiblePairCards = new int [4];
        int amountMatchingCards = 0;
        int cardCount = 0;

        for(int y=0; y<7; y++) {
            if(currentCardValues[f]==currentCardValues[y]) {
                amountMatchingCards++;
            }
            else {
                possiblePairCards[cardCount]=currentCardValues[y];
                cardCount++;
                if(cardCount>3) {
                    break;
                }
            }

        }
        if(amountMatchingCards==3) {
            triCardValue = currentCardValues[f];

            for(int x=0; x<4; x++) {
                amountMatchingCards=0;

                for(int y=0; y<4; y++) {
                    if(possiblePairCards[x]==possiblePairCards[y]) {
                        amountMatchingCards++;
                    }
                }
                if(amountMatchingCards>=2&&possiblePairCards[x]>pairCardValue) {
                    pairCardValue=possiblePairCards[x];
                    isFullHouse=true;
                }
            }
            break;
        }


    }

    if(isFullHouse==true) {
        currentScore = 600 + triCardValue + pairCardValue;
    }
    else {
        flush();
    }
}

public static void flush() {

    //Variables
    boolean isFlush = false;
    int typeAmount = 0;
    int highestTypeValue = 0;

    for(int f=0; f<4; f++) {

        for(int y=0; y<7;y++) {
            if(currentCardTypes[y]==f) {
                typeAmount++;

                if(currentCardValues[y]>highestTypeValue) {
                    highestTypeValue=currentCardValues[y];
                }

            }   
        }
        if(typeAmount>=5) {
            isFlush = true;
            break;
        }
        highestTypeValue=0;
        typeAmount=0;

    }

    if(isFlush==true) {
        currentScore=500+highestTypeValue;
    }
    else {
        straight();
    }

}

public static void straight() {

    boolean isStraight = true;
    boolean straightPossible = true;
    int amountCardsToCheck = 5;

    for (int f=2; f>=0;f--) {
        straightPossible = true;
        int y=0;

        for(y=0; y<amountCardsToCheck; y++) {

            //In case there are multiple numbers of the same Value card.
            if(f+y>0) {
                if(currentCardValues[f+y]==currentCardValues[f+y-1]) {
                    if(f+amountCardsToCheck<7) {
                        amountCardsToCheck++;
                    }
                }

                else if(currentCardValues[f]+y==currentCardValues[f+y]) {
                    straightPossible = true;
                }
                else {
                    straightPossible = false;
                    break;
                }
            }

            else if(currentCardValues[f]+y==currentCardValues[f+y]) {
                straightPossible = true;
            }
            else {
                straightPossible = false;
                break;
            }
            amountCardsToCheck = 5;
        }

        if(straightPossible==true) {
            isStraight = true;
            if(isStraight==true) {
                currentScore=400+currentCardValues[f+y-1];
            }
            else {
                threeOfAKind();
            }
            break;
        }

    }
}

public static void threeOfAKind() {
    int triCardValue = 0;
    boolean isThreeOAK = false;

    for(int f=0; f<7;f++) {
        int amountMatchingCards = 0;

        for(int y=0; y<7; y++) {
            if(currentCardValues[f]==currentCardValues[y]) {
                amountMatchingCards++;
            }

        }
        if(amountMatchingCards==3) {
            triCardValue = currentCardValues[f];
            isThreeOAK=true;
            break;
            }

    }

    if(isThreeOAK==true) {
        currentScore=300+triCardValue;
    }
    else {
        twoPair();
    }



}

public static void twoPair() {
    boolean isTwoPair=false;
    int pairCount = 0;
    int [] pairCardValues = new int [3];

    for(int f=0; f<7;f++) {
        int amountMatchingCards = 0;

        for(int y=0; y<7; y++) {
            if(currentCardValues[f]==currentCardValues[y]) {
                amountMatchingCards++;
            }
        }
        if(amountMatchingCards==2&&currentCardValues[f]!=pairCardValues[0]&&currentCardValues[f]!=pairCardValues[1]) {
            pairCardValues[pairCount]=currentCardValues[f];
            pairCount++;
        }
    }

    if(pairCount>=2) {
        arraySorter(pairCardValues);
        isTwoPair=true;
    }

    if(isTwoPair==true) {
        currentScore=200+pairCardValues[2]+pairCardValues[1];
    }
    else {
        pair();
    }
}

public static void pair() {
    boolean isPair=false;
    int pairValue = 0;

    for(int f=0; f<7;f++) {
        int amountMatchingCards = 0;

        for(int y=0; y<7; y++) {
            if(currentCardValues[f]==currentCardValues[y]) {
                amountMatchingCards++;
            }
        }
        if(amountMatchingCards==2&&currentCardValues[f]>pairValue) {
            pairValue=currentCardValues[f];
            isPair=true;
        }
    }

    if(isPair==true) {
        currentScore=100 + pairValue;
    }
    else {
        highCard();
    }
}

public static void highCard() {
    currentScore = maximum(currentCardValues);
}