|
|
@ -1,8 +1,7 @@ |
|
|
|
#include "blackjack.h" |
|
|
|
#include <stdio.h> |
|
|
|
#include <stdlib.h> |
|
|
|
#include <time.h> |
|
|
|
|
|
|
|
#include <stdbool.h> |
|
|
|
|
|
|
|
int blackjack(){ |
|
|
|
|
|
|
@ -62,6 +61,8 @@ int getRandCard(){ |
|
|
|
|
|
|
|
if(r > 10){ |
|
|
|
return 10; |
|
|
|
} else if(r == 1){ |
|
|
|
return 11; |
|
|
|
} |
|
|
|
|
|
|
|
return r; |
|
|
@ -87,6 +88,8 @@ int playBJ(int bet, int balance){ |
|
|
|
userCardArray[1] = getRandCard(); |
|
|
|
printf("user rand card: %d\n", userCardArray[1]); |
|
|
|
|
|
|
|
checkForBlackjack(userCardArray); |
|
|
|
|
|
|
|
|
|
|
|
free(userCardArray); |
|
|
|
} |
|
|
@ -95,4 +98,12 @@ int playBJ(int bet, int balance){ |
|
|
|
} |
|
|
|
|
|
|
|
return balance; |
|
|
|
} |
|
|
|
|
|
|
|
bool checkForBlackjack(int userCardArray[]){ |
|
|
|
if(userCardArray[0] + userCardArray[1] == 21){ |
|
|
|
printf("BLACKJACK!\n"); |
|
|
|
return true; |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |