|
|
@ -98,6 +98,7 @@ int playBJ(int bet, int balance){ |
|
|
|
if(dealerCardsArray){ |
|
|
|
dealerCardsArray[0] = getRandCard(0); |
|
|
|
printf("computer rand card: %d\n", dealerCardsArray[0]); |
|
|
|
generateCardAscii(dealerCardsArray[0]); |
|
|
|
|
|
|
|
// Array mit max 10 Karten anlegen |
|
|
|
int *userCardsArray = (int*) malloc(MAX_CARDS * sizeof(int)); |
|
|
@ -106,8 +107,11 @@ int playBJ(int bet, int balance){ |
|
|
|
|
|
|
|
userCardsArray[0] = getRandCard(1); |
|
|
|
printf("user rand card: %d\n", userCardsArray[0]); |
|
|
|
generateCardAscii(userCardsArray[0]); |
|
|
|
userCardsArray[1] = getRandCard(2); |
|
|
|
printf("user rand card: %d\n", userCardsArray[1]); |
|
|
|
generateCardAscii(userCardsArray[1]); |
|
|
|
|
|
|
|
|
|
|
|
if(checkForBlackjack(userCardsArray)){ |
|
|
|
winnings = calculateWinnings(true, bet); |
|
|
@ -133,6 +137,7 @@ int playBJ(int bet, int balance){ |
|
|
|
if(hit()){ |
|
|
|
userCardsArray[i] = getRandCard(i); |
|
|
|
printf("Your new card: %d\n", userCardsArray[i]); |
|
|
|
generateCardAscii(userCardsArray[i]); |
|
|
|
} else{ |
|
|
|
break; |
|
|
|
} |
|
|
@ -146,6 +151,7 @@ int playBJ(int bet, int balance){ |
|
|
|
if(dealerCardsTotal < 17){ |
|
|
|
dealerCardsArray[i] = getRandCard(i); |
|
|
|
printf("Dealer Card: %d\n", dealerCardsArray[i]); |
|
|
|
generateCardAscii(dealerCardsArray[i]); |
|
|
|
dealerCardsTotal = calculateCardsTotal(dealerCardsArray, i + 1); |
|
|
|
} |
|
|
|
printf("Dealer Cards Total: %d\n", dealerCardsTotal); |
|
|
|