acpc_dealer 2.4.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Brickfile +6 -0
- data/README.md +7 -6
- data/Rakefile +30 -14
- data/acpc_dealer.gemspec +2 -1
- data/bin/acpc_dealer +4 -0
- data/ext/hand_evaluator/extconf.rb +10 -0
- data/lib/acpc_dealer/version.rb +1 -1
- data/lib/hand_evaluator.bundle +0 -0
- data/spec/dealer_runner_spec.rb +76 -72
- metadata +19 -82
- data/vendor/project_acpc_server/LICENCE +0 -23
- data/vendor/project_acpc_server/Makefile +0 -35
- data/vendor/project_acpc_server/README +0 -113
- data/vendor/project_acpc_server/README.submission +0 -42
- data/vendor/project_acpc_server/acpc_play_match.pl +0 -101
- data/vendor/project_acpc_server/bm_run_matches.c +0 -238
- data/vendor/project_acpc_server/bm_server.c +0 -1604
- data/vendor/project_acpc_server/bm_server.config +0 -78
- data/vendor/project_acpc_server/bm_widget.c +0 -230
- data/vendor/project_acpc_server/dealer.c +0 -1293
- data/vendor/project_acpc_server/evalHandTables +0 -4269
- data/vendor/project_acpc_server/example_player.c +0 -204
- data/vendor/project_acpc_server/example_player.limit.2p.sh +0 -3
- data/vendor/project_acpc_server/example_player.limit.3p.sh +0 -3
- data/vendor/project_acpc_server/example_player.nolimit.2p.sh +0 -3
- data/vendor/project_acpc_server/example_player.nolimit.3p.sh +0 -3
- data/vendor/project_acpc_server/game.c +0 -1792
- data/vendor/project_acpc_server/game.h +0 -253
- data/vendor/project_acpc_server/holdem.limit.2p.reverse_blinds.game +0 -13
- data/vendor/project_acpc_server/holdem.limit.3p.game +0 -13
- data/vendor/project_acpc_server/holdem.nolimit.2p.reverse_blinds.game +0 -12
- data/vendor/project_acpc_server/holdem.nolimit.3p.game +0 -12
- data/vendor/project_acpc_server/kuhn.limit.3p.game +0 -14
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player.sf1.sh +0 -3
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player.sf2.sh +0 -3
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player.sf3.sh +0 -3
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/LICENCE +0 -23
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/Makefile +0 -127
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/README.md +0 -35
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/CExceptionConfig.h +0 -12
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/dealer_connection.c +0 -49
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/dealer_connection.h +0 -22
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/kuhn_3p_equilibrium_player.c +0 -483
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/kuhn_3p_equilibrium_player.h +0 -108
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/main.c +0 -84
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/player_config.c +0 -253
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/player_config.h +0 -21
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/support/test_helper.c +0 -45
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/support/test_helper.h +0 -27
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/test_kuhn_3p_equilibrium_player.c +0 -698
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/test_kuhn_3p_equilibrium_player_sub_family_1.c +0 -324
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/test_kuhn_3p_equilibrium_player_sub_family_2.c +0 -262
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/test_kuhn_3p_equilibrium_player_sub_family_3.c +0 -177
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/docs/license.txt +0 -30
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/docs/readme.txt +0 -242
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/lib/CException.c +0 -43
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/lib/CException.h +0 -86
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/release/build.info +0 -2
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/release/version.info +0 -2
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/History.md +0 -27
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/Makefile +0 -8
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/Readme.md +0 -103
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/package.json +0 -9
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/src/commander.c +0 -250
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/src/commander.h +0 -88
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/test.c +0 -34
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/colour_prompt.rb +0 -94
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/colour_reporter.rb +0 -39
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/generate_config.yml +0 -36
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/generate_module.rb +0 -202
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/generate_test_runner.rb +0 -316
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/test_file_filter.rb +0 -23
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/unity_test_summary.rb +0 -139
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/docs/Unity Summary.txt +0 -216
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/docs/license.txt +0 -31
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/release/build.info +0 -2
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/release/version.info +0 -2
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/src/unity.c +0 -1146
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/src/unity.h +0 -245
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/src/unity_internals.h +0 -546
- data/vendor/project_acpc_server/net.c +0 -218
- data/vendor/project_acpc_server/net.h +0 -62
- data/vendor/project_acpc_server/play_match.pl +0 -99
- data/vendor/project_acpc_server/protocol.md +0 -239
- data/vendor/project_acpc_server/protocol.odt +0 -0
- data/vendor/project_acpc_server/protocol.pdf +0 -0
- data/vendor/project_acpc_server/rng.c +0 -139
- data/vendor/project_acpc_server/rng.h +0 -63
- data/vendor/project_acpc_server/validate_submission.pl +0 -546
@@ -1,253 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Copyright (C) 2011 by the Computer Poker Research Group, University of Alberta
|
3
|
-
*/
|
4
|
-
|
5
|
-
#ifndef _GAME_H
|
6
|
-
#define _GAME_H
|
7
|
-
#define __STDC_FORMAT_MACROS
|
8
|
-
#include <inttypes.h>
|
9
|
-
#include "rng.h"
|
10
|
-
#include "net.h"
|
11
|
-
|
12
|
-
|
13
|
-
#define VERSION_MAJOR 2
|
14
|
-
#define VERSION_MINOR 0
|
15
|
-
#define VERSION_REVISION 0
|
16
|
-
|
17
|
-
|
18
|
-
#define MAX_ROUNDS 4
|
19
|
-
#define MAX_PLAYERS 10
|
20
|
-
#define MAX_BOARD_CARDS 7
|
21
|
-
#define MAX_HOLE_CARDS 3
|
22
|
-
#define MAX_NUM_ACTIONS 64
|
23
|
-
#define MAX_SUITS 4
|
24
|
-
#define MAX_RANKS 13
|
25
|
-
#define MAX_LINE_LEN READBUF_LEN
|
26
|
-
|
27
|
-
#define NUM_ACTION_TYPES 3
|
28
|
-
|
29
|
-
|
30
|
-
enum BettingType { limitBetting, noLimitBetting };
|
31
|
-
enum ActionType { a_fold = 0, a_call = 1, a_raise = 2,
|
32
|
-
a_invalid = NUM_ACTION_TYPES };
|
33
|
-
|
34
|
-
typedef struct {
|
35
|
-
enum ActionType type; /* is action a fold, call, or raise? */
|
36
|
-
int32_t size; /* for no-limit raises, we need a size
|
37
|
-
MUST BE 0 IN ALL CASES WHERE IT IS NOT USED */
|
38
|
-
} Action;
|
39
|
-
|
40
|
-
typedef struct {
|
41
|
-
|
42
|
-
/* stack sizes for each player */
|
43
|
-
int32_t stack[ MAX_PLAYERS ];
|
44
|
-
|
45
|
-
/* entry fee for game, per player */
|
46
|
-
int32_t blind[ MAX_PLAYERS ];
|
47
|
-
|
48
|
-
/* size of fixed raises for limitBetting games */
|
49
|
-
int32_t raiseSize[ MAX_ROUNDS ];
|
50
|
-
|
51
|
-
/* general class of game */
|
52
|
-
enum BettingType bettingType;
|
53
|
-
|
54
|
-
/* number of players in the game */
|
55
|
-
uint8_t numPlayers;
|
56
|
-
|
57
|
-
/* number of betting rounds */
|
58
|
-
uint8_t numRounds;
|
59
|
-
|
60
|
-
/* first player to act in a round */
|
61
|
-
uint8_t firstPlayer[ MAX_ROUNDS ];
|
62
|
-
|
63
|
-
/* number of bets/raises that may be made in each round */
|
64
|
-
uint8_t maxRaises[ MAX_ROUNDS ];
|
65
|
-
|
66
|
-
/* number of suits and ranks in the deck of cards */
|
67
|
-
uint8_t numSuits;
|
68
|
-
uint8_t numRanks;
|
69
|
-
|
70
|
-
/* number of private player cards */
|
71
|
-
uint8_t numHoleCards;
|
72
|
-
|
73
|
-
/* number of shared public cards each round */
|
74
|
-
uint8_t numBoardCards[ MAX_ROUNDS ];
|
75
|
-
} Game;
|
76
|
-
|
77
|
-
typedef struct {
|
78
|
-
uint32_t handId;
|
79
|
-
|
80
|
-
/* largest bet so far, including all previous rounds */
|
81
|
-
int32_t maxSpent;
|
82
|
-
|
83
|
-
/* minimum number of chips a player must have spend in total to raise
|
84
|
-
only used for noLimitBetting games */
|
85
|
-
int32_t minNoLimitRaiseTo;
|
86
|
-
|
87
|
-
/* spent[ p ] gives the total amount put into the pot by player p */
|
88
|
-
int32_t spent[ MAX_PLAYERS ];
|
89
|
-
|
90
|
-
/* action[ r ][ i ] gives the i'th action in round r */
|
91
|
-
Action action[ MAX_ROUNDS ][ MAX_NUM_ACTIONS ];
|
92
|
-
|
93
|
-
/* actingPlayer[ r ][ i ] gives the player who made action i in round r
|
94
|
-
we can always figure this out from the actions taken, but it's
|
95
|
-
easier to just remember this in multiplayer (because of folds) */
|
96
|
-
uint8_t actingPlayer[ MAX_ROUNDS ][ MAX_NUM_ACTIONS ];
|
97
|
-
|
98
|
-
/* numActions[ r ] gives the number of actions made in round r */
|
99
|
-
uint8_t numActions[ MAX_ROUNDS ];
|
100
|
-
|
101
|
-
/* current round: a value between 0 and game.numRounds-1
|
102
|
-
a showdown is still in numRounds-1, not a separate round */
|
103
|
-
uint8_t round;
|
104
|
-
|
105
|
-
/* finished is non-zero if and only if the game is over */
|
106
|
-
uint8_t finished;
|
107
|
-
|
108
|
-
/* playerFolded[ p ] is non-zero if and only player p has folded */
|
109
|
-
uint8_t playerFolded[ MAX_PLAYERS ];
|
110
|
-
|
111
|
-
/* public cards (including cards which may not yet be visible to players) */
|
112
|
-
uint8_t boardCards[ MAX_BOARD_CARDS ];
|
113
|
-
|
114
|
-
/* private cards */
|
115
|
-
uint8_t holeCards[ MAX_PLAYERS ][ MAX_HOLE_CARDS ];
|
116
|
-
} State;
|
117
|
-
|
118
|
-
typedef struct {
|
119
|
-
State state;
|
120
|
-
uint8_t viewingPlayer;
|
121
|
-
} MatchState;
|
122
|
-
|
123
|
-
|
124
|
-
/* returns a game structure, or NULL on failure */
|
125
|
-
Game *readGame( FILE *file );
|
126
|
-
|
127
|
-
void printGame( FILE *file, const Game *game );
|
128
|
-
|
129
|
-
/* initialise a state so that it is at the beginning of a hand
|
130
|
-
DOES NOT DEAL OUT CARDS */
|
131
|
-
void initState( const Game *game, const uint32_t handId, State *state );
|
132
|
-
|
133
|
-
/* shuffle a deck of cards and deal them out, writing the results to state */
|
134
|
-
void dealCards( const Game *game, rng_state_t *rng, State *state );
|
135
|
-
|
136
|
-
int statesEqual( const Game *game, const State *a, const State *b );
|
137
|
-
|
138
|
-
int matchStatesEqual( const Game *game, const MatchState *a,
|
139
|
-
const MatchState *b );
|
140
|
-
|
141
|
-
/* check if a raise is possible, and the range of valid sizes
|
142
|
-
returns non-zero if raise is a valid action and sets *minSize
|
143
|
-
and maxSize, or zero if raise is not valid */
|
144
|
-
int raiseIsValid( const Game *game, const State *curState,
|
145
|
-
int32_t *minSize, int32_t *maxSize );
|
146
|
-
|
147
|
-
/* check if an action is valid
|
148
|
-
|
149
|
-
if tryFixing is non-zero, try modifying the given action to produce
|
150
|
-
a valid action, as in the AAAI rules. Currently this only means
|
151
|
-
that a no-limit raise will be modified to the nearest valid raise size
|
152
|
-
|
153
|
-
returns non-zero if final action/size is valid for state, 0 otherwise */
|
154
|
-
int isValidAction( const Game *game, const State *curState,
|
155
|
-
const int tryFixing, Action *action );
|
156
|
-
|
157
|
-
/* record the given action in state
|
158
|
-
does not check that action is valid */
|
159
|
-
void doAction( const Game *game, const Action *action, State *state );
|
160
|
-
|
161
|
-
/* returns non-zero if hand is finished, zero otherwise */
|
162
|
-
#define stateFinished( constStatePtr ) ((constStatePtr)->finished)
|
163
|
-
|
164
|
-
/* get the current player to act in the state */
|
165
|
-
uint8_t currentPlayer( const Game *game, const State *state );
|
166
|
-
|
167
|
-
/* number of raises in the current round */
|
168
|
-
uint8_t numRaises( const State *state );
|
169
|
-
|
170
|
-
/* number of players who have folded */
|
171
|
-
uint8_t numFolded( const Game *game, const State *state );
|
172
|
-
|
173
|
-
/* number of players who have called the current bet (or initiated it)
|
174
|
-
doesn't count non-acting players who are all-in */
|
175
|
-
uint8_t numCalled( const Game *game, const State *state );
|
176
|
-
|
177
|
-
/* number of players who are all-in */
|
178
|
-
uint8_t numAllIn( const Game *game, const State *state );
|
179
|
-
|
180
|
-
/* number of players who can still act (ie not all-in or folded) */
|
181
|
-
uint8_t numActingPlayers( const Game *game, const State *state );
|
182
|
-
|
183
|
-
/* get the index into array state.boardCards[] for the first board
|
184
|
-
card in round (where the first round is round 0) */
|
185
|
-
uint8_t bcStart( const Game *game, const uint8_t round );
|
186
|
-
|
187
|
-
/* get the total number of board cards dealt out after (zero based) round */
|
188
|
-
uint8_t sumBoardCards( const Game *game, const uint8_t round );
|
189
|
-
|
190
|
-
/* return the value of a finished hand for a player
|
191
|
-
returns a double because pots may be split when players tie
|
192
|
-
WILL HAVE UNDEFINED BEHAVIOUR IF HAND ISN'T FINISHED
|
193
|
-
(stateFinished(state)==0) */
|
194
|
-
double valueOfState( const Game *game, const State *state,
|
195
|
-
const uint8_t player );
|
196
|
-
|
197
|
-
/* returns number of characters consumed on success, -1 on failure
|
198
|
-
state will be modified even on a failure to read */
|
199
|
-
int readState( const char *string, const Game *game, State *state );
|
200
|
-
|
201
|
-
/* returns number of characters consumed on success, -1 on failure
|
202
|
-
state will be modified even on a failure to read */
|
203
|
-
int readMatchState( const char *string, const Game *game, MatchState *state );
|
204
|
-
|
205
|
-
/* print a state to a string, as viewed by viewingPlayer
|
206
|
-
returns the number of characters in string, or -1 on error
|
207
|
-
DOES NOT COUNT FINAL 0 TERMINATOR IN THIS COUNT!!! */
|
208
|
-
int printState( const Game *game, const State *state,
|
209
|
-
const int maxLen, char *string );
|
210
|
-
|
211
|
-
/* print a state to a string, as viewed by viewingPlayer
|
212
|
-
returns the number of characters in string, or -1 on error
|
213
|
-
DOES NOT COUNT FINAL 0 TERMINATOR IN THIS COUNT!!! */
|
214
|
-
int printMatchState( const Game *game, const MatchState *state,
|
215
|
-
const int maxLen, char *string );
|
216
|
-
|
217
|
-
/* read an action, returning the action in the passed pointer
|
218
|
-
action and size will be modified even on a failure to read
|
219
|
-
returns number of characters consumed on succes, -1 on failure */
|
220
|
-
int readAction( const char *string, const Game *game, Action *action );
|
221
|
-
|
222
|
-
/* print an action to a string
|
223
|
-
returns the number of characters in string, or -1 on error
|
224
|
-
DOES NOT COUNT FINAL 0 TERMINATOR IN THIS COUNT!!! */
|
225
|
-
int printAction( const Game *game, const Action *action,
|
226
|
-
const int maxLen, char *string );
|
227
|
-
|
228
|
-
/* returns number of characters consumed, or -1 on error
|
229
|
-
on success, returns the card in *card */
|
230
|
-
int readCard( const char *string, uint8_t *card );
|
231
|
-
|
232
|
-
/* read up to maxCards cards
|
233
|
-
returns number of cards successfully read
|
234
|
-
returns number of characters consumed in charsConsumed */
|
235
|
-
int readCards( const char *string, const int maxCards,
|
236
|
-
uint8_t *cards, int *charsConsumed );
|
237
|
-
|
238
|
-
/* print a card to a string
|
239
|
-
returns the number of characters in string, or -1 on error
|
240
|
-
DOES NOT COUNT FINAL 0 TERMINATOR IN THIS COUNT!!! */
|
241
|
-
int printCard( const uint8_t card, const int maxLen, char *string );
|
242
|
-
|
243
|
-
/* print out numCards cards to a string
|
244
|
-
returns the number of characters in string
|
245
|
-
DOES NOT COUNT FINAL 0 TERMINATOR IN THIS COUNT!!! */
|
246
|
-
int printCards( const int numCards, const uint8_t *cards,
|
247
|
-
const int maxLen, char *string );
|
248
|
-
|
249
|
-
#define rankOfCard( card ) ((card)/MAX_SUITS)
|
250
|
-
#define suitOfCard( card ) ((card)%MAX_SUITS)
|
251
|
-
#define makeCard( rank, suit ) ((rank)*MAX_SUITS+(suit))
|
252
|
-
|
253
|
-
#endif
|
@@ -1,23 +0,0 @@
|
|
1
|
-
Copyright (C) 2013 by the Computer Poker Research Group, University of Alberta
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
4
|
-
this software and associated documentation files (the "Software"), to deal in
|
5
|
-
the Software without restriction, including without limitation the rights to
|
6
|
-
use, copy, modify, merge, publish, distribute, sublicence, and/or sell copies
|
7
|
-
of the Software, and to permit persons to whom the Software is furnished to do
|
8
|
-
so, subject to the following conditions:
|
9
|
-
|
10
|
-
The above copyright notice and this permission notice shall be included in all
|
11
|
-
copies or substantial portions of the Software.
|
12
|
-
|
13
|
-
Except as contained in this notice, the name(s) of the above copyright holders
|
14
|
-
shall not be used in advertising or otherwise to promote the sale, use or other
|
15
|
-
dealings in this Software without prior written authorization.
|
16
|
-
|
17
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
-
SOFTWARE.
|
@@ -1,127 +0,0 @@
|
|
1
|
-
THIS_DIR := $(CURDIR)/$(dir $(lastword $(MAKEFILE_LIST)))
|
2
|
-
PROJECT_DIR := $(THIS_DIR)/../
|
3
|
-
|
4
|
-
CC = gcc -std=gnu99
|
5
|
-
CFLAGS = -O3
|
6
|
-
LIBS = -lm
|
7
|
-
TARGET_SYMBOLS = -DCEXCEPTION_USE_CONFIG_FILE
|
8
|
-
|
9
|
-
VENDOR_DIR := $(THIS_DIR)/vendor/
|
10
|
-
COMMANDER_DIR := $(VENDOR_DIR)/commander.c
|
11
|
-
TARGET_INCLUDES = -I$(PROJECT_DIR) -I$(THIS_DIR)/src -I$(CEXCEPTION_LIB) -I$(COMMANDER_DIR)/src
|
12
|
-
|
13
|
-
CEXCEPTION_DIR := $(VENDOR_DIR)/cexception/
|
14
|
-
CEXCEPTION_LIB := $(CEXCEPTION_DIR)/lib
|
15
|
-
CEXCEPTION_SRC := $(CEXCEPTION_LIB)/CException.c
|
16
|
-
|
17
|
-
TARGET_BASE = kuhn_3p_equilibrium_player
|
18
|
-
TARGET_SRC_DIR := $(THIS_DIR)/src
|
19
|
-
TARGET_SRC := $(TARGET_SRC_DIR)/$(TARGET_BASE).c $(CEXCEPTION_SRC)
|
20
|
-
|
21
|
-
PROJECT_SRC := $(PROJECT_DIR)/game.c $(PROJECT_DIR)/rng.c $(PROJECT_DIR)/net.c
|
22
|
-
|
23
|
-
BUILD_PREFIX := $(CC) $(CFLAGS) $(TARGET_SYMBOLS)
|
24
|
-
|
25
|
-
TARGET := $(THIS_DIR)/$(TARGET_BASE)
|
26
|
-
|
27
|
-
default: $(TARGET)
|
28
|
-
|
29
|
-
# Build target
|
30
|
-
#==============
|
31
|
-
$(TARGET): $(TARGET_SRC) $(PROJECT_DIR)/evalHandTables $(PROJECT_DIR)/game.h $(PROJECT_DIR)/net.h $(PROJECT_DIR)/rng.h
|
32
|
-
$(BUILD_PREFIX) -Wall $(TARGET_INCLUDES) $(TARGET_SRC) $(TARGET_SRC_DIR)/main.c $(TARGET_SRC_DIR)/player_config.c $(TARGET_SRC_DIR)/dealer_connection.c $(COMMANDER_DIR)/src/commander.c $(LIBS) -o $@ $(PROJECT_SRC)
|
33
|
-
chmod 755 $@
|
34
|
-
|
35
|
-
# Testing
|
36
|
-
#===========
|
37
|
-
UNITY_DIR := $(VENDOR_DIR)/unity
|
38
|
-
TEST_DIR := $(THIS_DIR)/test
|
39
|
-
TEST_SUPPORT_DIR := $(TEST_DIR)/support
|
40
|
-
INC_DIRS := -I$(UNITY_DIR)/src -I$(TEST_SUPPORT_DIR) -I$(THIS_DIR)/src $(TARGET_INCLUDES)
|
41
|
-
SYMBOLS = -DTEST -DUNITY_FLOAT_TYPE=double -DUNITY_FLOAT_VERBOSE
|
42
|
-
TEST_BASE := $(TEST_DIR)/test_$(TARGET_BASE)
|
43
|
-
ifeq ($(OS),Windows_NT)
|
44
|
-
TEST_EXTENSION=.exe
|
45
|
-
else
|
46
|
-
TEST_EXTENSION=.out
|
47
|
-
endif
|
48
|
-
|
49
|
-
# Test 1
|
50
|
-
#-------------
|
51
|
-
TEST1_BASE := $(TEST_BASE)
|
52
|
-
TEST1_SRC := $(TEST1_BASE).c
|
53
|
-
TEST1 := $(TEST1_BASE)$(TEST_EXTENSION)
|
54
|
-
TEST1_RUNNER := $(TEST1_BASE)_Runner.c
|
55
|
-
|
56
|
-
$(TEST1_RUNNER):
|
57
|
-
ruby $(UNITY_DIR)/auto/generate_test_runner.rb $(TEST1_SRC) $(TEST1_RUNNER)
|
58
|
-
|
59
|
-
$(TEST1): $(TARGET) $(TEST1_RUNNER)
|
60
|
-
$(BUILD_PREFIX) $(SYMBOLS) $(INC_DIRS) $(TARGET_SRC) $(PROJECT_SRC) $(TEST_SUPPORT_DIR)/test_helper.c $(UNITY_DIR)/src/unity.c $(TEST1_SRC) $(TEST1_RUNNER) $(LIBS) -o $(TEST1)
|
61
|
-
|
62
|
-
# Test 2
|
63
|
-
#-------------
|
64
|
-
TEST2_BASE := $(TEST_BASE)_sub_family_1
|
65
|
-
TEST2_SRC := $(TEST2_BASE).c
|
66
|
-
TEST2 := $(TEST2_BASE)$(TEST_EXTENSION)
|
67
|
-
TEST2_RUNNER := $(TEST2_BASE)_Runner.c
|
68
|
-
|
69
|
-
$(TEST2_RUNNER):
|
70
|
-
ruby $(UNITY_DIR)/auto/generate_test_runner.rb $(TEST2_SRC) $(TEST2_RUNNER)
|
71
|
-
|
72
|
-
$(TEST2): $(TARGET) $(TEST2_RUNNER)
|
73
|
-
$(BUILD_PREFIX) $(SYMBOLS) $(INC_DIRS) $(TARGET_SRC) $(PROJECT_SRC) $(TEST_SUPPORT_DIR)/test_helper.c $(UNITY_DIR)/src/unity.c $(TEST2_SRC) $(TEST2_RUNNER) $(LIBS) -o $(TEST2)
|
74
|
-
|
75
|
-
# Test 3
|
76
|
-
#-------------
|
77
|
-
TEST3_BASE := $(TEST_BASE)_sub_family_2
|
78
|
-
TEST3_SRC := $(TEST3_BASE).c
|
79
|
-
TEST3 := $(TEST3_BASE)$(TEST_EXTENSION)
|
80
|
-
TEST3_RUNNER := $(TEST3_BASE)_Runner.c
|
81
|
-
|
82
|
-
$(TEST3_RUNNER):
|
83
|
-
ruby $(UNITY_DIR)/auto/generate_test_runner.rb $(TEST3_SRC) $(TEST3_RUNNER)
|
84
|
-
|
85
|
-
$(TEST3): $(TARGET) $(TEST3_RUNNER)
|
86
|
-
$(BUILD_PREFIX) $(SYMBOLS) $(INC_DIRS) $(TARGET_SRC) $(PROJECT_SRC) $(TEST_SUPPORT_DIR)/test_helper.c $(UNITY_DIR)/src/unity.c $(TEST3_SRC) $(TEST3_RUNNER) $(LIBS) -o $(TEST3)
|
87
|
-
|
88
|
-
# Test 4
|
89
|
-
#-------------
|
90
|
-
TEST4_BASE := $(TEST_BASE)_sub_family_3
|
91
|
-
TEST4_SRC := $(TEST4_BASE).c
|
92
|
-
TEST4 := $(TEST4_BASE)$(TEST_EXTENSION)
|
93
|
-
TEST4_RUNNER := $(TEST4_BASE)_Runner.c
|
94
|
-
|
95
|
-
$(TEST4_RUNNER):
|
96
|
-
ruby $(UNITY_DIR)/auto/generate_test_runner.rb $(TEST4_SRC) $(TEST4_RUNNER)
|
97
|
-
|
98
|
-
$(TEST4): $(TARGET) $(TEST4_RUNNER)
|
99
|
-
$(BUILD_PREFIX) $(SYMBOLS) $(INC_DIRS) $(TARGET_SRC) $(PROJECT_SRC) $(TEST_SUPPORT_DIR)/test_helper.c $(UNITY_DIR)/src/unity.c $(TEST4_SRC) $(TEST4_RUNNER) $(LIBS) -o $(TEST4)
|
100
|
-
|
101
|
-
# Basic functionality exercise with the dealer
|
102
|
-
#-------------------------------
|
103
|
-
$(PROJECT_DIR)/dealer:
|
104
|
-
cd $(PROJECT_DIR) && make
|
105
|
-
|
106
|
-
dealer_test: clean $(TARGET) $(PROJECT_DIR)/dealer
|
107
|
-
cd $(PROJECT_DIR) && ./dealer m kuhn.limit.3p.game 100 1 p1 p2 p3 &
|
108
|
-
sleep 0.1 # Ensure the dealer has started and is ready to accept connections
|
109
|
-
./kuhn_3p_equilibrium_player -0 0.0 -1 0.25 -2 0.25 -4 0.9375 --c33 0.0 --c34 1.0 -p 18791 -g ../kuhn.limit.3p.game & # Sub-family 1
|
110
|
-
./kuhn_3p_equilibrium_player --c11 0.5 --b11 0.25 --b21 0.0 --b23 0.125 --b32 0.75 --c33 0.0 --c34 0.75 -p 18374 -g ../kuhn.limit.3p.game & # Sub-family 2
|
111
|
-
./kuhn_3p_equilibrium_player --c11 0.33 --b11 0.166667 --b32 0.791667 --c33 0.0 --c34 0.75 -p 59497 -g ../kuhn.limit.3p.game & # Sub-family 3
|
112
|
-
|
113
|
-
# Automatic tests (require Ruby)
|
114
|
-
#--------------------------------
|
115
|
-
test: clean $(TEST1) $(TEST2) $(TEST3) $(TEST4)
|
116
|
-
$(TEST1)
|
117
|
-
$(TEST2)
|
118
|
-
$(TEST3)
|
119
|
-
$(TEST4)
|
120
|
-
|
121
|
-
# Clean
|
122
|
-
#============
|
123
|
-
clean:
|
124
|
-
rm -f $(TARGET) *.o *.il *.out $(TEST1) $(TEST2) $(TEST3) $(TEST4) $(TEST1_RUNNER) $(TEST2_RUNNER) $(TEST3_RUNNER) $(TEST4_RUNNER) $(THIS_DIR)/test/*.out
|
125
|
-
|
126
|
-
dist_clean: clean
|
127
|
-
rm -f *~ core
|