I'm a complete amateur but just in case you know less than I do, here is some example code from a text based blackjack I attempted to make which may give you some ideas:
class blackjack {
private:
std::vector<card> deck;
int minBet;
int maxBet;
int decks;
public:
blackjack(int minBet, int maxBet, int decks);
~blackjack() {};
void shuffle();
void reshuffle();
int getValue(std::vector<card> hand) const;
card deal();
void play(std::shared_ptr<player> p);
bool check_for_blackjack(std::vector<card> hand);
bool bust(std::vector<card> hand);
};
blackjack::blackjack(int minBet, int maxBet, int decks)
{
this->minBet = minBet;
this->maxBet = maxBet;
this->decks = decks;
this->reshuffle();
}
void blackjack::shuffle()
{
static std::random_device rd;
std::shuffle(this->deck.begin(), this->deck.end(), std::mt19937(rd()));
}
void blackjack::reshuffle()
{
this->deck.clear();
for (int i = 1; i < 14; ++i)
{
for (int j = 1; j < 5; ++j)
{
if (i == 1)
{
card c1("Ace", i, j);
this->deck.push_back(c1);
}
else if (i == 11)
{
card c1("Jack", i - 1, j);
this->deck.push_back(c1);
}
else if (i == 12)
{
card c1("Queen", i - 2, j);
this->deck.push_back(c1);
}
else if (i == 13)
{
card c1("King", i - 3, j);
this->deck.push_back(c1);
}
else
{
card c1(std::to_string(i), i, j);
this->deck.push_back(c1);
}
}
}
}
card blackjack::deal()
{
card dealCard = this->deck[this->deck.size() - 1];
this->deck.pop_back();
return dealCard;
}
int blackjack::getValue(std::vector<card> hand) const
{
int value = 0;
for (card &c : hand)
{
value += c.value;
}
return value;
}
bool blackjack::check_for_blackjack(std::vector<card> hand)
{
int value = 0;
for (auto &i : hand)
{
value += i.value;
}
if (value == 21)
{
return true;
}
else
return false;
}
bool blackjack::bust(std::vector<card> hand)
{
int value = 0;
for (auto &i : hand)
{
value += i.value;
}
if (value > 21)
{
return true;
}
else
return false;
}
/*-------------------------------------------------------------------------------------------------------*/
class card {
public:
std::string name;
int value;
int suit;
card(std::string name, int value, int suit);
card() {};
~card() {};
std::string getSuit() const;
void display() const;
};
card::card(std::string name, int value, int suit)
{
this->name = name;
this->value = value;
this->suit = suit;
}
void card::display() const
{
print(this->name);
if (suit == 1) { print(" of Hearts\n"); }
if (suit == 2) { print(" of Diamonds\n"); }
if (suit == 3) { print(" of Clubs\n"); }
if (suit == 4) { print(" of Spades\n"); }
}
std::string card::getSuit() const
{
if (this->suit == 1)
{
return "Hearts";
}
if (this->suit == 2)
{
return "Diamonds";
}
if (this->suit == 3)
{
return "Clubs";
}
if (this->suit == 4)
{
return "Spades";
}
else
return "Something went wrong";
}