|
@ -10,10 +10,16 @@ int blackjack(){ |
|
|
printf("Welcome to Blackjack \n"); |
|
|
printf("Welcome to Blackjack \n"); |
|
|
|
|
|
|
|
|
int balance = getBalanceBJ(); |
|
|
int balance = getBalanceBJ(); |
|
|
int bet = getBetBJ(balance); |
|
|
|
|
|
printf("bet: %d\n", bet); |
|
|
|
|
|
|
|
|
|
|
|
printf("rand card: %d\n", getRandCard()); |
|
|
printf("rand card: %d\n", getRandCard()); |
|
|
|
|
|
|
|
|
|
|
|
while(balance > 0){ |
|
|
|
|
|
int bet = getBetBJ(balance); |
|
|
|
|
|
balance -= bet; |
|
|
|
|
|
|
|
|
|
|
|
playBJ(bet, balance); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -63,4 +69,18 @@ int getRandCard(){ |
|
|
return r; |
|
|
return r; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int playBJ(int bet, int balance){ |
|
|
|
|
|
|
|
|
|
|
|
int *computerCardArray = (int*) malloc(10 * sizeof(int)); |
|
|
|
|
|
|
|
|
|
|
|
if(computerCardArray){ |
|
|
|
|
|
computerCardArray[0] = getRandCard(); |
|
|
|
|
|
printf("computer rand card: %d\n", computerCardArray[0]); |
|
|
|
|
|
|
|
|
|
|
|
free(computerCardArray); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return balance; |
|
|
} |
|
|
} |