poker 3/4 kind of
#1

pawn Код:
// Four of a Kind Check
       // Three of a Kind Check
        for(new i = 0; i < 4; i++) {
                for(new j = 0; j < 13; j++) {
                        if(suitArray[i][j] == 1) {
                                for(new c = 0; c < 4; c++) {
                                        if(suitArray[c][j] == 1) {
                                                tmp++;
                                        }
                                }
                                if(tmp == 4) {
                                        isFour = true;
                                }
                                else if(tmp >= 3) {
                                        isThree = true;
                                } else {
                                        tmp = 0;
                                }
                        }
                }
        }
Why could this return false 4 kind of? It returns 4 kind of even if there is only 3 kind of..
Reply
#2

Try changing else if(tmp >= 3) to else if(tmp == 3)
Reply
#3

what is "suitArray" why u checking if it's 1 twice?

just wondering
Reply
#4

pawn Код:
// Four of a Kind Check
       // Three of a Kind Check
        for(new j = 0; j < 13; j++)
        {
            for(new c = 0; c < 4; c++)
            {
                if(suitArray[c][j] == 1) tmp++;
            }
            if(tmp == 4) isFour = true;
            if(tmp == 3) isThree = true;
            else tmp = 0;
        }
Reply
#5

Quote:
Originally Posted by Threshold
Посмотреть сообщение
pawn Код:
// Four of a Kind Check
       // Three of a Kind Check
        for(new j = 0; j < 13; j++)
        {
            for(new c = 0; c < 4; c++)
            {
                if(suitArray[c][j] == 1) tmp++;
            }
            if(tmp == 4) isFour = true;
            if(tmp == 3) isThree = true;
            else tmp = 0;
        }
This still returns false 4 kind of. And now even full house is messed up:

http://oi60.tinypic.com/5l2f48.jpg
http://oi57.tinypic.com/a9vgoj.jpg

Whole script can be found on: http://pastebin.com/3FtF3MAc
Reply
#6

pawn Код:
// Four of a Kind Check
// Three of a Kind Check
// Two Pair & Pair Check
        for(new j = 0; j < 13; j++) {
            for(new i = 0; i < 4; i++) {
                if(suitArray[i][j] == 1) tmp++;
            }
            switch(tmp) {
                case 4: {
                    isFour = true;
                    break;
                }
                case 3: {
                    isThree = true;
                }
                case 2: {
                    if(++pairs == 2) {
                        isTwoPair = true;
                    }
                    isPair = true;
                }
            }
            tmp = 0;
        }

// Straight Check
        for(new j = 0; j < 13; j++) {
            if((suitArray[0][j] | suitArray[1][j] | suitArray[2][j] | suitArray[3][j]) == 1) {
                if(++tmp == 5) {
                    isStraight = true;
                    break;
                }
            } else {
                tmp = 0;
            }
        }
        if((tmp == 4) && ((suitArray[0][0] | suitArray[1][0] | suitArray[2][0] | suitArray[3][0]) == 1)) {
            isStraight = true;
        }
        tmp = 0;

// Convert Hand to Singles
       
        pokerArray[0] %= 13;
        pokerArray[1] %= 13;

// Convert Aces to worth 13.

        if(pokerArray[0] == 0) pokerArray[0] = 13;
        if(pokerArray[1] == 0) pokerArray[1] = 13;

// 7) POKER_RESULT_FULL_HOUSE - Three of a kind combined with a pair. * THREE KIND + PAIR *
        if(isThree && isPair /* instead of isTwoPair */) {
                SetPVarString(playerid, "pkrResultString", "Full House");
                return 700 + pokerArray[0] + pokerArray[1];
        }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)