The program works fine instead for the ace.. I am going to post partial parts of the program here so you get the main idea how the program works. If you need the full code I will PM it to you...
Now as you know (or may not) in blackjack ace can be counted as 1 or 11 according to your total score. If your total score, with the ace dealt, is smaller than 21 it is counted as 11, if it is bigger than 21 it is counted as 1.
Code:
#define CARD_VALUES 13
void ShuffleDeck(void);
int DealTwoCards(void);
int DealCard(void);
int PlayersTurn(int);
int DealersTurn(int);
int aces, twos, threes, fours, fives, sixes, sevens, eights, nines, tens, jacks, queens, kings;
int initPlayerScore, initDealerScore, newPlayerScore, newDealerScore;
I am aware I have to change card_values 13 to card_values 14...
Code:
void ShuffleDeck(void)
{
aces = 4; twos = 4; threes = 4;
fours = 4; fives = 4; sixes = 4;
sevens = 4; eights = 4; nines = 4;
tens = 4; jacks = 4; queens = 4;
kings = 4;
}
int DealTwoCards(void)
{
int addedScore;
addedScore = DealCard() + DealCard();
return addedScore;
}
no problem here..
Code:
int DealCard()
{
int card, cardValue;
card = 1 + (int) rand() % CARD_VALUES;
if (card == 1)
{
cardValue = 1;
printf("\t dealt an ace\n");
aces--;
}
else if (card == 2)
{
cardValue = 2;
printf("\t dealt a two\n");
twos--;
}
.
.
.
.
return cardValue;
}
So this is how I have written it.. I hope it is understandable..
How on the hell am I going to make ace take two values..??