Blackjack
Loading...
Searching...
No Matches
blackjack.h
Go to the documentation of this file.
1
10#ifndef BLACKJACK_H
11#define BLACKJACK_H
12
13#include "player.h"
14#include "deck.h"
15#include <vector>
16
23using Players = std::vector<Player*>;
24
29static constexpr int playerLimit{ 21 };
30
35static constexpr int dealerLimit{ 17 };
36
42{
43private:
44 Deck m_deck{};
45 std::size_t m_numPlayers{};
46 Players m_players{};
47 Players active_players{}; // holds the players not busted yet
48
56 bool gameNotOver();
57
63 int getMaxScore();
64
69 void computePlayerOutcomes();
70
71public:
80 {
81 m_numPlayers = players.size();
82
83 for (auto& player : players)
84 {
85 m_players.push_back(player);
86 active_players.push_back(player);
87 }
88 }
89
94 void resetPlayers();
95
100 void play();
101
106 void displayResult();
107};
108
109#endif
std::vector< Player * > Players
Players is a vector of Player addresses
Definition blackjack.h:23
A game of Blackjack is defined by the players, a deck of cards, and a few parameters based on the rul...
Definition blackjack.h:42
void play()
Play a game of Blackjack.
Definition blackjack.cpp:116
Blackjack(Players &players)
Initialize the players playing Blackjack.
Definition blackjack.h:79
void resetPlayers()
Reset each player.
Definition blackjack.cpp:22
void displayResult()
Display the result for each player.
Definition blackjack.cpp:90
Definition deck.h:24
Defines a Deck of cards.
Defines the contract for a Player.