#include "card.h" #include /** * Calculate the score of a single card * Cards divisible by 5: 2 points * Cards divisible by 10: 3 points * Cards divisible by 11: 5 points * Card 55 (divisible by 5 and 11): 7 points * @return Score of the card */ uint32_t card_get_points(const card c) { assert(c > 0 && c <= 105); if (55 == c) return 7; // Card 55 is worth of 7 points if (c % 11 == 0) return 5; // Cards that are multiples of 11 are worth 5 points if (c % 10 == 0) return 3; // ... 10 are worth 3 points if (c % 5 == 0) return 2; // ... 5 are worth 2 points return 1; // All other cards are worth 1 point }