-
Notifications
You must be signed in to change notification settings - Fork 2
/
game.h
59 lines (45 loc) · 998 Bytes
/
game.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
/* Copyright 2011 Tuna <tuna@supertunaman.com
* This code is under the Chicken Dance License v0.1 */
#ifndef GAME_H
#define GAME_H
typedef struct game *game_tp;
#include "card.h"
#include "deck.h"
#include "player.h"
typedef struct pot {
int content;
int bet;
player_t **players;
int n_players;
} pot_t;
enum game_phase {
PHASE_PRE_DEAL,
PHASE_PRE_FLOP,
PHASE_FLOP,
PHASE_TURN,
PHASE_RIVER
};
struct game {
/* infrastructure */
card_t deck[52];
card_t community[5]; /* the community cards */
player_t *players;
int n_players;
pot_t *pots;
int n_pots;
/* rules */
int small_blind, big_blind;
int betting_unit;
int base_stock;
/* TODO: limits */
player_t *house; /* overlord */
/* situation */
enum game_phase phase;
int turn;
int button;
};
void deal_community(game_tp);
game_tp new_game(int n_players);
void free_game(game_tp);
int next_player(game_tp, int playeridx);
#endif