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,108 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Copyright (C) 2013 by the Computer Poker Research Group, University of Alberta
|
3
|
-
*/
|
4
|
-
|
5
|
-
#ifndef __KUHN_3P_EQUILIBRIUM_PLAYER_H__
|
6
|
-
#define __KUHN_3P_EQUILIBRIUM_PLAYER_H__
|
7
|
-
|
8
|
-
#include <game.h>
|
9
|
-
#include <rng.h>
|
10
|
-
#include <net.h>
|
11
|
-
|
12
|
-
// Types ----------------
|
13
|
-
typedef enum {
|
14
|
-
C11_INDEX = 0,
|
15
|
-
B11_INDEX,
|
16
|
-
B21_INDEX,
|
17
|
-
B23_INDEX,
|
18
|
-
B32_INDEX,
|
19
|
-
B33_INDEX,
|
20
|
-
B41_INDEX,
|
21
|
-
C21_INDEX,
|
22
|
-
C33_INDEX,
|
23
|
-
C34_INDEX,
|
24
|
-
NUM_PARAMS
|
25
|
-
} ParameterIndex;
|
26
|
-
|
27
|
-
typedef struct {
|
28
|
-
uint32_t seed;
|
29
|
-
rng_state_t get_action_rng;
|
30
|
-
const Game* game_def;
|
31
|
-
double params[NUM_PARAMS];
|
32
|
-
} Kuhn3pEquilibriumPlayer;
|
33
|
-
|
34
|
-
typedef enum{JACK_RANK = 9, QUEEN_RANK, KING_RANK, ACE_RANK} CardRank;
|
35
|
-
|
36
|
-
typedef enum{A_POSITION = 0, B_POSITION, C_POSITION, NUM_PLAYERS} PlayerPosition;
|
37
|
-
|
38
|
-
// Constants -------------
|
39
|
-
#define KUHN_SUIT 3
|
40
|
-
#define JACK makeCard(JACK_RANK, KUHN_SUIT)
|
41
|
-
#define QUEEN makeCard(QUEEN_RANK, KUHN_SUIT)
|
42
|
-
#define KING makeCard(KING_RANK, KUHN_SUIT)
|
43
|
-
#define ACE makeCard(ACE_RANK, KUHN_SUIT)
|
44
|
-
#define NUM_CARDS 4
|
45
|
-
|
46
|
-
#define KAPPA (1/24.0)
|
47
|
-
|
48
|
-
static const int SUB_FAMILY_1_INDEPENDENT_PARAMS[] = {
|
49
|
-
B11_INDEX, B21_INDEX, B32_INDEX, C33_INDEX, C34_INDEX
|
50
|
-
};
|
51
|
-
|
52
|
-
static const int SUB_FAMILY_2_INDEPENDENT_PARAMS[] = {
|
53
|
-
B11_INDEX, B21_INDEX, B23_INDEX, B32_INDEX, C33_INDEX, C34_INDEX
|
54
|
-
};
|
55
|
-
|
56
|
-
static const int SUB_FAMILY_3_INDEPENDENT_PARAMS[] = {
|
57
|
-
B11_INDEX, B32_INDEX, C33_INDEX, C34_INDEX
|
58
|
-
};
|
59
|
-
|
60
|
-
// Necessary params for P1
|
61
|
-
static const double A[][4] = {
|
62
|
-
{0.0, 0.0, 0.0, 0.0},
|
63
|
-
{0.0, 0.0, 0.0, 0.0},
|
64
|
-
{0.0, 0.0, 1/2.0, 0.0},
|
65
|
-
{0.0, 1.0, 1.0, 1.0}
|
66
|
-
};
|
67
|
-
|
68
|
-
// Necessary params for P2
|
69
|
-
#define B12 0.0
|
70
|
-
#define B13 0.0
|
71
|
-
#define B14 0.0
|
72
|
-
#define B22 0.0
|
73
|
-
#define B24 0.0
|
74
|
-
#define B31 0.0
|
75
|
-
#define B34 0.0
|
76
|
-
#define B42 1.0
|
77
|
-
#define B43 1.0
|
78
|
-
#define B44 1.0
|
79
|
-
|
80
|
-
// Necessary params for P3
|
81
|
-
#define C12 0.0
|
82
|
-
#define C13 0.0
|
83
|
-
#define C14 0.0
|
84
|
-
#define C22 0.0
|
85
|
-
#define C23 0.0
|
86
|
-
#define C24 0.0
|
87
|
-
#define C31 0.0
|
88
|
-
#define C32 0.0
|
89
|
-
static const double C4[] = {1.0, 1.0, 1.0, 1.0};
|
90
|
-
|
91
|
-
// Functions -----------------
|
92
|
-
double beta(const Kuhn3pEquilibriumPlayer* kuhn_3p_e_player);
|
93
|
-
Kuhn3pEquilibriumPlayer new_kuhn_3p_equilibrium_player(
|
94
|
-
const Game* game_def,
|
95
|
-
const double* params,
|
96
|
-
uint32_t seed
|
97
|
-
);
|
98
|
-
Action action(
|
99
|
-
Kuhn3pEquilibriumPlayer* player,
|
100
|
-
MatchState view
|
101
|
-
);
|
102
|
-
void action_probs(
|
103
|
-
const Kuhn3pEquilibriumPlayer* player,
|
104
|
-
MatchState view,
|
105
|
-
double* probs
|
106
|
-
);
|
107
|
-
|
108
|
-
#endif
|
@@ -1,84 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Copyright (C) 2013 by the Computer Poker Research Group, University of Alberta
|
3
|
-
*/
|
4
|
-
|
5
|
-
#include <stdlib.h>
|
6
|
-
#include <assert.h>
|
7
|
-
#include <netdb.h>
|
8
|
-
#include <sys/socket.h>
|
9
|
-
#include <netinet/in.h>
|
10
|
-
#include <netinet/tcp.h>
|
11
|
-
#include "game.h"
|
12
|
-
#include "rng.h"
|
13
|
-
#include "net.h"
|
14
|
-
#include "kuhn_3p_equilibrium_player.h"
|
15
|
-
#include "player_config.h"
|
16
|
-
|
17
|
-
int main(int argc, char **argv)
|
18
|
-
{
|
19
|
-
PlayerConfig config = new_player_config_from_argv(argc, argv);
|
20
|
-
|
21
|
-
connect_to_dealer(&config.dealer);
|
22
|
-
|
23
|
-
int len, r;
|
24
|
-
MatchState state;
|
25
|
-
char line[ MAX_LINE_LEN ];
|
26
|
-
|
27
|
-
Kuhn3pEquilibriumPlayer player = new_kuhn_3p_equilibrium_player(
|
28
|
-
config.game,
|
29
|
-
config.params,
|
30
|
-
config.seed
|
31
|
-
);
|
32
|
-
|
33
|
-
/* play the game! */
|
34
|
-
while( fgets( line, MAX_LINE_LEN, config.dealer.fromServer ) ) {
|
35
|
-
/* ignore comments */
|
36
|
-
if( line[ 0 ] == '#' || line[ 0 ] == ';' ) {
|
37
|
-
continue;
|
38
|
-
}
|
39
|
-
|
40
|
-
len = readMatchState( line, config.game, &state );
|
41
|
-
if( len < 0 ) {
|
42
|
-
fprintf( stderr, "ERROR: could not read state %s", line );
|
43
|
-
exit( EXIT_FAILURE );
|
44
|
-
}
|
45
|
-
|
46
|
-
if(stateFinished( &state.state)) {
|
47
|
-
/* ignore the game over message */
|
48
|
-
continue;
|
49
|
-
}
|
50
|
-
|
51
|
-
if(currentPlayer(config.game, &state.state) != state.viewingPlayer) {
|
52
|
-
/* we're not acting */
|
53
|
-
continue;
|
54
|
-
}
|
55
|
-
|
56
|
-
/* add a colon (guaranteed to fit because we read a new-line in fgets) */
|
57
|
-
line[ len ] = ':';
|
58
|
-
++len;
|
59
|
-
|
60
|
-
Action action_to_send = action(&player, state);
|
61
|
-
|
62
|
-
/* do the action! */
|
63
|
-
assert(isValidAction(config.game, &state.state, 0, &action_to_send));
|
64
|
-
r = printAction(config.game, &action_to_send, MAX_LINE_LEN - len - 2, &line[len]);
|
65
|
-
|
66
|
-
if( r < 0 ) {
|
67
|
-
fprintf( stderr, "ERROR: line too long after printing action\n" );
|
68
|
-
exit( EXIT_FAILURE );
|
69
|
-
}
|
70
|
-
len += r;
|
71
|
-
line[ len ] = '\r';
|
72
|
-
++len;
|
73
|
-
line[ len ] = '\n';
|
74
|
-
++len;
|
75
|
-
|
76
|
-
if( fwrite(line, 1, len, config.dealer.toServer) != len ) {
|
77
|
-
fprintf( stderr, "ERROR: could not get send response to server\n" );
|
78
|
-
exit(EXIT_FAILURE);
|
79
|
-
}
|
80
|
-
fflush(config.dealer.toServer);
|
81
|
-
}
|
82
|
-
|
83
|
-
return EXIT_SUCCESS;
|
84
|
-
}
|
@@ -1,253 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Copyright (C) 2013 by the Computer Poker Research Group, University of Alberta
|
3
|
-
*/
|
4
|
-
|
5
|
-
#include <stdlib.h>
|
6
|
-
#include <assert.h>
|
7
|
-
#include <string.h>
|
8
|
-
#include <stdio.h>
|
9
|
-
#include <stdarg.h>
|
10
|
-
#include <unistd.h>
|
11
|
-
#include <sys/time.h>
|
12
|
-
#include "rng.h"
|
13
|
-
#include "commander.h"
|
14
|
-
#include "player_config.h"
|
15
|
-
|
16
|
-
static void parse(
|
17
|
-
const char* to_parse,
|
18
|
-
const char* template,
|
19
|
-
const char* error_message,
|
20
|
-
size_t num_targets,
|
21
|
-
...
|
22
|
-
)
|
23
|
-
{
|
24
|
-
va_list scan_targets;
|
25
|
-
va_start(scan_targets, num_targets);
|
26
|
-
|
27
|
-
if(vsscanf(to_parse, template, scan_targets) < num_targets) {
|
28
|
-
fprintf(stderr, "ERROR: %s: %s\n", error_message, to_parse);
|
29
|
-
exit(EXIT_FAILURE);
|
30
|
-
}
|
31
|
-
va_end(scan_targets);
|
32
|
-
}
|
33
|
-
|
34
|
-
static void c11(command_t *self) {
|
35
|
-
assert(self->data);
|
36
|
-
|
37
|
-
PlayerConfig* config = self->data;
|
38
|
-
parse(
|
39
|
-
self->arg,
|
40
|
-
"%lf",
|
41
|
-
"Invalid C11 parameter",
|
42
|
-
1,
|
43
|
-
&config->params[C11_INDEX]
|
44
|
-
);
|
45
|
-
}
|
46
|
-
|
47
|
-
static void b11(command_t *self) {
|
48
|
-
assert(self->data);
|
49
|
-
PlayerConfig* config = self->data;
|
50
|
-
parse(
|
51
|
-
self->arg,
|
52
|
-
"%lf",
|
53
|
-
"Invalid B11 parameter",
|
54
|
-
1,
|
55
|
-
&config->params[B11_INDEX]
|
56
|
-
);
|
57
|
-
}
|
58
|
-
|
59
|
-
static void b21(command_t *self) {
|
60
|
-
assert(self->data);
|
61
|
-
PlayerConfig* config = self->data;
|
62
|
-
parse(
|
63
|
-
self->arg,
|
64
|
-
"%lf",
|
65
|
-
"Invalid B21 parameter",
|
66
|
-
1,
|
67
|
-
&config->params[B21_INDEX]
|
68
|
-
);
|
69
|
-
}
|
70
|
-
|
71
|
-
static void b23(command_t *self) {
|
72
|
-
assert(self->data);
|
73
|
-
PlayerConfig* config = self->data;
|
74
|
-
parse(
|
75
|
-
self->arg,
|
76
|
-
"%lf",
|
77
|
-
"Invalid B23 parameter",
|
78
|
-
1,
|
79
|
-
&config->params[B23_INDEX]
|
80
|
-
);
|
81
|
-
}
|
82
|
-
|
83
|
-
static void b32(command_t *self) {
|
84
|
-
assert(self->data);
|
85
|
-
PlayerConfig* config = self->data;
|
86
|
-
parse(
|
87
|
-
self->arg,
|
88
|
-
"%lf",
|
89
|
-
"Invalid B32 parameter",
|
90
|
-
1,
|
91
|
-
&config->params[B32_INDEX]
|
92
|
-
);
|
93
|
-
}
|
94
|
-
|
95
|
-
static void c33(command_t *self) {
|
96
|
-
assert(self->data);
|
97
|
-
PlayerConfig* config = self->data;
|
98
|
-
parse(
|
99
|
-
self->arg,
|
100
|
-
"%lf",
|
101
|
-
"Invalid C33 parameter",
|
102
|
-
1,
|
103
|
-
&config->params[C33_INDEX]
|
104
|
-
);
|
105
|
-
}
|
106
|
-
|
107
|
-
static void c34(command_t *self) {
|
108
|
-
assert(self->data);
|
109
|
-
PlayerConfig* config = self->data;
|
110
|
-
parse(
|
111
|
-
self->arg,
|
112
|
-
"%lf",
|
113
|
-
"Invalid C34 parameter",
|
114
|
-
1,
|
115
|
-
&config->params[C34_INDEX]
|
116
|
-
);
|
117
|
-
}
|
118
|
-
|
119
|
-
static void r(command_t *self) {
|
120
|
-
assert(self->data);
|
121
|
-
PlayerConfig* config = self->data;
|
122
|
-
parse(
|
123
|
-
self->arg,
|
124
|
-
"%"SCNu32,
|
125
|
-
"Invalid random seed",
|
126
|
-
1,
|
127
|
-
&config->seed
|
128
|
-
);
|
129
|
-
}
|
130
|
-
|
131
|
-
static void parse_game_def(command_t *self)
|
132
|
-
{
|
133
|
-
assert(self->data);
|
134
|
-
|
135
|
-
PlayerConfig* config = self->data;
|
136
|
-
|
137
|
-
FILE* file = fopen(self->arg, "r");
|
138
|
-
if (!file) {
|
139
|
-
fprintf( stderr, "ERROR: could not open game %s\n", self->arg );
|
140
|
-
exit( EXIT_FAILURE );
|
141
|
-
}
|
142
|
-
|
143
|
-
config->game = readGame( file );
|
144
|
-
if (!config->game) {
|
145
|
-
fprintf( stderr, "ERROR: could not read game %s\n", self->arg );
|
146
|
-
exit( EXIT_FAILURE );
|
147
|
-
}
|
148
|
-
fclose( file );
|
149
|
-
}
|
150
|
-
|
151
|
-
static void get_host(command_t *self)
|
152
|
-
{
|
153
|
-
if (!self->arg) {
|
154
|
-
return;
|
155
|
-
}
|
156
|
-
assert(self->data);
|
157
|
-
|
158
|
-
PlayerConfig* config = self->data;
|
159
|
-
|
160
|
-
memset(config->dealer.host, 0,
|
161
|
-
_POSIX_HOST_NAME_MAX * sizeof(*config->dealer.host));
|
162
|
-
strncpy(config->dealer.host, self->arg, _POSIX_HOST_NAME_MAX);
|
163
|
-
}
|
164
|
-
|
165
|
-
static void get_port(command_t *self)
|
166
|
-
{
|
167
|
-
assert(self->data);
|
168
|
-
|
169
|
-
PlayerConfig* config = self->data;
|
170
|
-
|
171
|
-
parse(
|
172
|
-
self->arg,
|
173
|
-
"%"SCNu16,
|
174
|
-
"Invalid port",
|
175
|
-
1,
|
176
|
-
&config->dealer.port
|
177
|
-
);
|
178
|
-
}
|
179
|
-
|
180
|
-
PlayerConfig new_player_config()
|
181
|
-
{
|
182
|
-
// If no random seed is given, initialize the player's random number seed
|
183
|
-
// using time
|
184
|
-
struct timeval tv;
|
185
|
-
gettimeofday(&tv, NULL);
|
186
|
-
rng_state_t rng;
|
187
|
-
init_genrand(&rng, tv.tv_usec);
|
188
|
-
|
189
|
-
PlayerConfig this = {
|
190
|
-
.dealer = new_dealer_connection(),
|
191
|
-
.game = NULL,
|
192
|
-
.params = {0},
|
193
|
-
.seed = genrand_int32(&rng)
|
194
|
-
};
|
195
|
-
|
196
|
-
return this;
|
197
|
-
}
|
198
|
-
|
199
|
-
PlayerConfig new_player_config_from_argv(int argc, char** argv)
|
200
|
-
{
|
201
|
-
command_t cmd;
|
202
|
-
command_init(&cmd, argv[0], "0.0.1");
|
203
|
-
|
204
|
-
command_option(
|
205
|
-
&cmd,
|
206
|
-
"-n",
|
207
|
-
"--host [host name]",
|
208
|
-
"Name of the host on which dealer is running (defaults to 'localhost')",
|
209
|
-
get_host
|
210
|
-
);
|
211
|
-
command_option(
|
212
|
-
&cmd,
|
213
|
-
"-p",
|
214
|
-
"--port <port number>",
|
215
|
-
"Port number to connect to dealer",
|
216
|
-
get_port
|
217
|
-
);
|
218
|
-
command_option(
|
219
|
-
&cmd,
|
220
|
-
"-g",
|
221
|
-
"--game <file name>",
|
222
|
-
"Game definition file name",
|
223
|
-
parse_game_def
|
224
|
-
);
|
225
|
-
command_option(
|
226
|
-
&cmd,
|
227
|
-
"-r",
|
228
|
-
"--seed [non-negative integer]",
|
229
|
-
"Random seed, defaults to a random random seed based on system time.",
|
230
|
-
r
|
231
|
-
);
|
232
|
-
|
233
|
-
command_option(&cmd, "-0", "--c11 <probability>", "C11 value", c11);
|
234
|
-
command_option(&cmd, "-1", "--b11 <probability>", "B11 value", b11);
|
235
|
-
command_option(&cmd, "-2", "--b21 [probability]", "B21 value", b21);
|
236
|
-
command_option(&cmd, "-3", "--b23 [probability]", "B23 value", b23);
|
237
|
-
command_option(&cmd, "-4", "--b32 <probability>", "B32 value", b32);
|
238
|
-
command_option(&cmd, "-8", "--c33 <probability>", "C33 value", c33);
|
239
|
-
command_option(&cmd, "-9", "--c34 <probability>", "C34 value", c34);
|
240
|
-
|
241
|
-
if( argc < 14 ) {
|
242
|
-
command_help(&cmd);
|
243
|
-
exit(EXIT_SUCCESS);
|
244
|
-
}
|
245
|
-
|
246
|
-
PlayerConfig config = new_player_config();
|
247
|
-
cmd.data = &config;
|
248
|
-
|
249
|
-
command_parse(&cmd, argc, argv);
|
250
|
-
command_free(&cmd);
|
251
|
-
|
252
|
-
return config;
|
253
|
-
}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Copyright (C) 2013 by the Computer Poker Research Group, University of Alberta
|
3
|
-
*/
|
4
|
-
|
5
|
-
#ifndef __PLAYER_CONFIG_H__
|
6
|
-
#define __PLAYER_CONFIG_H__
|
7
|
-
|
8
|
-
#include "dealer_connection.h"
|
9
|
-
#include "kuhn_3p_equilibrium_player.h"
|
10
|
-
|
11
|
-
typedef struct {
|
12
|
-
DealerConnection dealer;
|
13
|
-
Game *game;
|
14
|
-
double params[NUM_PARAMS];
|
15
|
-
uint32_t seed;
|
16
|
-
} PlayerConfig;
|
17
|
-
|
18
|
-
PlayerConfig new_player_config();
|
19
|
-
PlayerConfig new_player_config_from_argv(int argc, char** argv);
|
20
|
-
|
21
|
-
#endif
|