Exemplo n.º 1
0
int main()
{
    chance_scores_sum_of_all_dice();
    yahtzee_scores_50();
    test_1s();
    test_2s(); 
    test_threes();
    fours_test();
    fives();
    sixes_test();
    one_pair();
    two_Pair();
    three_of_a_kind();
    four_of_a_knd();
    smallStraight();
    largeStraight(); 
    fullHouse();
}
Exemplo n.º 2
0
//get the card power, as follow:
//royal flush: 900 + all the cards values
//straight flush: 800 + all the cards values
//four of a kind: 700 + all the cards values
//full house: 600 + all the cards values
//flush: 500 + all the cards values
//straight: 400 + all the cards values
//three of a kind: 300 + all the cards values
//two pairs: 200 + all the cards values
//pair: 100 + all the cards values
//high card: sum of all the cards value (5 * 13 will never be more than 100 so...)
int getHandPower(Card c[5]) {
    p = sumCardNums(c, 0);
    p += sumCardNums(c, 1);
    sortCards(c);

    if(royalFlush(c)) {
        p += 900;
        return p;
    }
    if(straightFlush(c)) {
        p += 800;
        return p;
    }
    if(fourOfAKind(c)) {
        p += 700;
        return p;
    }
    if(fullHouse(c)) {
        p += 600;
        return p;
    }
    if(flush(c)) {
        p += 500;
        return p;
    }
    if(straight(c)) {
        p += 400;
        return p;
    }
    if(threeOfAKind(c)) {
        p += 300;
        return p;
    }
    if(twoPairs(c)) {
        p += 200;
        return p;
    }
    if(pair(c)) {
        p += 100;
        return p;
    }
    return p; 
}