-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.c
64 lines (56 loc) · 1.26 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include <stdio.h>
#include "main.h"
#include "userInput.h"
#include "dealing.h"
#include "hit.h"
#include "rounds.h"
#include "evaluate1.h"
#include "winnings1.h"
//#include "evaluate.h"
//#include "winnings.h"
void playGame(){
//take each players bet
betTaker();
//deal all players their intial hand
dealHand();
//display each players hand
displayHand();
//loop through each player
int i;
for (i = 0; i < numPlayers; i++){
printf("Player %d:\n", i+1);
int hit = hitDecide(i);
while (hit == 1) {
dealCard(i, 0);
displayHand();
hit = hitDecide(i);
}
}
//hit for the computer
computerHit();
for (i = 0; i < numPlayers; i++){
int winner = evaluate(i);
int money = distributeWinnings(winner, i);
keepTrackOfWinnings(money, i);
}
}
int main(){
numRounds = 1;
//ask for number of players
numberOfPlayers();
//ask players to choose a level
selectLevel();
//play game
playGame();
int round = playAgain();
while (round == 1){
reset();
numRounds++;
playGame();
round = playAgain();
}
if (round == 0){
displayFinalScore();
}
return 0;
}