-
Notifications
You must be signed in to change notification settings - Fork 0
/
player.h
103 lines (61 loc) · 2.21 KB
/
player.h
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#ifndef PLAYER_H
#define PLAYER_H
typedef struct _Player Player;
#include "hand.h"
#include "macros.h"
#include "table.h"
/* function pointer type */
typedef Player *(*bet_function_type)(Player *, Table *);
typedef Player *(*play_function_type)(Player *, Table *);
/* initialize a player with only one hand */
Player* player_ini(bet_function_type, play_function_type);
/* destroy a player */
void player_destroy(Player*);
/*
* Make a bet.
*/
Player* player_bet(Player*, Table*);
/* make a play */
Player* player_play(Player*, Table*);
/* adds a card to the hand */
Player* player_addCardToHand(Player*,int numHand, int rank);
/* adds cash to the player */
Player* player_addCash(Player*, long);
/* removes cash from the player */
Player* player_removeCash(Player*, long);
/* return win condition of each hand, by order */
Peg* player_handsCondition(Crupier*, Player*);
/* increase win, tie or lose and num played, cmpValue=0 (crupier wins), cmpValue=1(tie) cmpValue=2(player wins) */
Player* player_addGame (Player* , Peg);
/* restart player hands */
Player* player_restartHands (Player*);
/* set the field of player LastBet*/
Player *player_setLastBet(Player *, long);
/* refresh Win, Tie or Lose streak of a player*/
Player *player_refreshStreak(Player *, Peg);
/* split player i-hand, return index of new hand */
int player_splitHand(Player*, int numHand);
/* next functions allow access to different fields of Player */
int player_getTotalCards(Player*);
long player_getCash(Player*);
long player_getLastBet(Player*);
Peg player_getLastPlay(Player*);
int player_getNWin(Player*);
int player_getNTie(Player*);
int player_getNLost(Player*);
int player_getNPlayed(Player*);
double player_getWinRatio(Player *);
double player_getTieRatio(Player *);
double player_getLostRatio(Player *);
Hand* player_getHand(Player*, int numHand);
int player_getNHands(Player*);
int player_getCurrentWinStreak(Player *);
int player_getCurrentTieStreak(Player *);
int player_getCurrentLoseStreak(Player *);
int player_getMaxWinStreak(Player *);
int player_getMaxTieStreak(Player *);
int player_getMaxLoseStreak(Player *);
Player* player_blackJack(Player* );
int player_getNBlackJack(Player*);
void player_print(FILE*, Player*);
#endif