|
@ -1,5 +1,7 @@ |
|
|
#include "blackjack.h" |
|
|
#include "blackjack.h" |
|
|
#include <stdio.h> |
|
|
#include <stdio.h> |
|
|
|
|
|
#include <stdlib.h> |
|
|
|
|
|
#include <time.h> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int blackjack(){ |
|
|
int blackjack(){ |
|
@ -10,6 +12,7 @@ int blackjack(){ |
|
|
int balance = getBalanceBJ(); |
|
|
int balance = getBalanceBJ(); |
|
|
int bet = getBetBJ(balance); |
|
|
int bet = getBetBJ(balance); |
|
|
printf("bet: %d\n", bet); |
|
|
printf("bet: %d\n", bet); |
|
|
|
|
|
printf("rand card: %d\n", getRandCard()); |
|
|
|
|
|
|
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
@ -42,3 +45,22 @@ int userInputBJ(){ |
|
|
scanf("%d", &input); |
|
|
scanf("%d", &input); |
|
|
return input; |
|
|
return input; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Liefert eine Zufallszahl zwischen 1 und 10 |
|
|
|
|
|
// Chance für 10 ist 4 Mal höher als für den Rest |
|
|
|
|
|
// 1 = Ass |
|
|
|
|
|
int getRandCard(){ |
|
|
|
|
|
|
|
|
|
|
|
srand(time(NULL)); |
|
|
|
|
|
|
|
|
|
|
|
int r = rand() % 13; |
|
|
|
|
|
r++; |
|
|
|
|
|
|
|
|
|
|
|
if(r > 10){ |
|
|
|
|
|
return 10; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return r; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |