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