Blackjack
Loading...
Searching...
No Matches
deck.h
Go to the documentation of this file.
1
10#ifndef DECK_H
11#define DECK_H
12
13#include "card.h"
14#include <array>
15
20constexpr std::size_t numCards{ 52 };
21using CardArray = std::array<Card, numCards>;
22
23class Deck
24{
25private:
26 CardArray m_deck{};
27 std::size_t m_cardIndex{ 0 };
28
29public:
34 Deck();
35
36 void print() const;
37
42 void shuffle();
43
49 const Card& dealCard();
50};
51
52#endif
Defines a Card.
A Card is defined by its rank (see CardRank) and suit (see CardSuit).
Definition card.h:22
Definition deck.h:24
Deck()
Initialize the deck of cards.
Definition deck.cpp:21
const Card & dealCard()
Deal a card (the top one) from the deck.
Definition deck.cpp:57
void shuffle()
Shuffle the deck.
Definition deck.cpp:43
void print() const
Definition deck.cpp:31
std::array< Card, numCards > CardArray
Definition deck.h:21
constexpr std::size_t numCards
A deck has 52 cards.
Definition deck.h:20