-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeck.h
52 lines (43 loc) · 773 Bytes
/
deck.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/**
* @file deck.h
* @author DSN
* @brief Defines a \c Deck of cards
* @version 0.2
* @date 2023-08-19
*
*/
#ifndef DECK_H
#define DECK_H
#include "card.h"
#include <array>
/**
* @brief A deck has \c 52 cards.
*
*/
constexpr std::size_t numCards{ 52 };
using CardArray = std::array<Card, numCards>;
class Deck
{
private:
CardArray m_deck{};
std::size_t m_cardIndex{ 0 };
public:
/**
* @brief Initialize the deck of cards
*
*/
Deck();
void print() const;
/**
* @brief Shuffle the deck
*
*/
void shuffle();
/**
* @brief Deal a card (the top one) from the deck
*
* @return const Card&: a constant reference to the dealt card
*/
const Card& dealCard();
};
#endif