So I'm creating a game of Blackjack. Everything is done, all the logic written out and works, but for some reason the deck won't notice that a card has been taken from it. (Sorry if the code doesn't look visually correct, I wasn't sure how to put it in as text on here) Here's the code for my Deck class:
Deck::Deck(int shoe) {
int counter = 0;
this->Shoe = shoe;
for (int i = 0; i < shoe; i++) {
for (int j = 1; j <= 13; j++){
for (int k = 0; k < 4; k++) {
this->FullDeck[counter] = j;
counter++;
}
}
}
}
int Deck::DrawCard() {
int value = 0;
int Random = 0;
do {
Random = rand() % (this->Shoe * 52) - 1;
} while (this->FullDeck[Random] == 0);
value = this->FullDeck[Random];
this->FullDeck[Random] = 0; //Here it should be setting it to 0, but once the function returns the array gets set back to what it was before
return value;
}
Deck::Deck()
{
}
Deck::~Deck()
{
}
>
And my Deck.h file:
<
#pragma once
class Deck
{
public:
Deck();
Deck(int shoe);
int DrawCard();
~Deck();