|
@ -66,10 +66,13 @@ int userInputBJ(){ |
|
|
// Chance für 10 ist 4 Mal höher als für den Rest |
|
|
// Chance für 10 ist 4 Mal höher als für den Rest |
|
|
// 1 = Ass |
|
|
// 1 = Ass |
|
|
int getRandCard(int offset){ |
|
|
int getRandCard(int offset){ |
|
|
srand(time(NULL) + offset); |
|
|
|
|
|
|
|
|
int randomCard; |
|
|
|
|
|
srand(time(NULL)); |
|
|
|
|
|
|
|
|
int randomCard = rand() % ANZ_MOEGLICHE_KARTEN; |
|
|
|
|
|
randomCard++; |
|
|
|
|
|
|
|
|
for(int i = 0; i < offset; i++){ |
|
|
|
|
|
|
|
|
|
|
|
randomCard = (rand() % ANZ_MOEGLICHE_KARTEN) + 1; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 11, 12, 13 = Bube, Dame, König haben den Wert 10 |
|
|
// 11, 12, 13 = Bube, Dame, König haben den Wert 10 |
|
|
if(randomCard > 10){ |
|
|
if(randomCard > 10){ |
|
@ -147,7 +150,7 @@ int playBJ(int bet, int balance){ |
|
|
} |
|
|
} |
|
|
printf("Dealer Cards Total: %d\n", dealerCardsTotal); |
|
|
printf("Dealer Cards Total: %d\n", dealerCardsTotal); |
|
|
|
|
|
|
|
|
if(dealerCardsTotal >= 17 && dealerCardsTotal < 21){ |
|
|
|
|
|
|
|
|
if(dealerCardsTotal >= 17 && dealerCardsTotal <= 21){ |
|
|
if(calculateIfYouWon(userCardsTotal, dealerCardsTotal)){ |
|
|
if(calculateIfYouWon(userCardsTotal, dealerCardsTotal)){ |
|
|
winnings = calculateWinnings(false, bet); |
|
|
winnings = calculateWinnings(false, bet); |
|
|
} |
|
|
} |
|
@ -215,6 +218,7 @@ int calculateCardsTotal(int cardsArray[], int len){ |
|
|
} |
|
|
} |
|
|
if(aceFound && sum + cardsArray[i] > 21){ |
|
|
if(aceFound && sum + cardsArray[i] > 21){ |
|
|
sum -= 10; |
|
|
sum -= 10; |
|
|
|
|
|
aceFound = false; |
|
|
} |
|
|
} |
|
|
sum += cardsArray[i]; |
|
|
sum += cardsArray[i]; |
|
|
} |
|
|
} |
|
|