Working on refactoring winning.

This commit is contained in:
2022-11-20 23:17:40 -08:00
parent 5762f12841
commit ad34be05e3
4 changed files with 62 additions and 40 deletions

View File

@ -45,6 +45,11 @@ namespace Dawn {
static void fillDeck(std::vector<struct Card> *deck);
static void shuffle(std::vector<struct Card> *deck);
static bool_t contains(std::vector<struct Card> *deck, struct Card);
static std::vector<struct Card> countPairs(
std::vector<struct Card> *deck,
enum CardValue value
);
/**
* Sort a hand of cards. Cards are ordered in descending weight, aces are
@ -58,9 +63,12 @@ namespace Dawn {
Card(CardSuit suit, CardValue num) :
cardValue((suit * CARD_COUNT_PER_SUIT) + num)
{
assertTrue(suit < CARD_SUIT_COUNT);
assertTrue(num < CARD_COUNT_PER_SUIT);
}
Card(uint8_t cv) : cardValue(cv) {
assertTrue(cv < CARD_DECK_SIZE);
}
CardValue getValue() {