X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=kub.c;h=299eb07667a8892489a34df9c7d226780d442131;hb=84b0ed8b8cbbfbee04853a590f89eb7d55008f74;hp=ff190581b6f4f7a2dd253815d571e72e001a617a;hpb=37bb3dc4133f4317de3b00423fea6778248c27ca;p=kub diff --git a/kub.c b/kub.c index ff19058..299eb07 100644 --- a/kub.c +++ b/kub.c @@ -77,31 +77,7 @@ static void player_init(player_t *player) static int card_compare(card_t *card_one, card_t *card_two) { - if (card_one.number < card_two.number) - return -1; - if (card_one.number == card_two.number) - return 0; - if (card_one.number > card_two.number) - return 1; -} - -static int card_group_is_run(card_group_t *card_group) -{ - if (card_group->num_cards > 13 || card_group->num_cards < 3) - { - return 0; - } - for (i = 0; i < card_group->num_cards - 1; ++i) - if(card_group->cards[i].color != card_group->cards[i + 1].color) - { - return 0; - } - for (i = 0; i < card_group->num_cards - 1; ++i) - if(card_group->cards[i].number != card_group->cards[i + 1].number -1) - { - return 0; - } - return 1; + return card_one->number - card_two->number; } static int card_group_is_run(card_group_t *card_group) @@ -118,6 +94,9 @@ static int card_group_is_run(card_group_t *card_group) { return 0; } + } + for (i = 0; i < card_group->num_cards; ++i) + { if (card_group->cards[i].number > highest) { highest = card_group->cards[i].number;