acpc_dealer 2.0.6 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +4 -2
- data/lib/acpc_dealer.rb +6 -2
- data/lib/acpc_dealer/version.rb +1 -1
- data/vendor/project_acpc_server/Makefile +12 -2
- data/vendor/project_acpc_server/README +1 -0
- data/vendor/project_acpc_server/example_player.limit.2p.sh +2 -1
- data/vendor/project_acpc_server/example_player.limit.3p.sh +2 -1
- data/vendor/project_acpc_server/example_player.nolimit.2p.sh +2 -1
- data/vendor/project_acpc_server/example_player.nolimit.3p.sh +2 -1
- data/vendor/project_acpc_server/kuhn.limit.3p.game +14 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player.sf1.sh +3 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player.sf2.sh +3 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player.sf3.sh +3 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/LICENCE +23 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/Makefile +128 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/README.md +35 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/CExceptionConfig.h +12 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/dealer_connection.c +49 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/dealer_connection.h +22 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/kuhn_3p_equilibrium_player.c +483 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/kuhn_3p_equilibrium_player.h +107 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/main.c +84 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/player_config.c +252 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/player_config.h +21 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/support/test_helper.c +45 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/support/test_helper.h +27 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/test_kuhn_3p_equilibrium_player.c +698 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/test_kuhn_3p_equilibrium_player_sub_family_1.c +324 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/test_kuhn_3p_equilibrium_player_sub_family_2.c +262 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/test_kuhn_3p_equilibrium_player_sub_family_3.c +177 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/docs/CExceptionSummary.odt +0 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/docs/CExceptionSummary.pdf +0 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/docs/license.txt +30 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/docs/readme.txt +242 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/lib/CException.c +43 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/lib/CException.h +86 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/release/build.info +2 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/release/version.info +2 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/config/production_environment.rb +14 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/config/test_environment.rb +16 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/docs/CMock Summary.odt +0 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/docs/CMock Summary.pdf +0 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/docs/CMock_Summary.md +356 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/docs/license.txt +31 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/SAM7_FLASH.mac +71 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/SAM7_RAM.mac +94 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/SAM7_SIM.mac +67 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_FLASH.xcl +185 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_RAM.xcl +185 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/ioat91sam7x256.ddf +2259 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/cmock_demo.dep +3691 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/cmock_demo.ewd +1696 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/cmock_demo.ewp +2581 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/cmock_demo.eww +10 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X-EK.h +61 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.inc +2314 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.rdf +4704 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.tcl +3407 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256_inc.h +2268 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/ioat91sam7x256.h +4380 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/lib_AT91SAM7X256.h +4211 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/settings/cmock_demo.cspy.bat +32 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/settings/cmock_demo.dbgdt +86 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/settings/cmock_demo.dni +42 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/settings/cmock_demo.wsdt +76 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/srcIAR/Cstartup.s79 +266 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/srcIAR/Cstartup_SAM7.c +98 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/Resource/SAM7_FLASH.mac +71 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/Resource/SAM7_RAM.mac +94 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/Resource/SAM7_SIM.mac +67 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_FLASH.icf +43 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_RAM.icf +42 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/cmock_demo.dep +4204 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/cmock_demo.ewd +1906 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/cmock_demo.ewp +2426 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/cmock_demo.eww +26 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X-EK.h +61 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X256_inc.h +2268 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/incIAR/lib_AT91SAM7X256.h +4211 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/incIAR/project.h +30 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.cspy.bat +33 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dbgdt +5 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dni +18 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.wsdt +74 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X_FLASH_Debug.jlink +12 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo.cspy.bat +33 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo.dbgdt +85 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo.dni +44 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo.wsdt +73 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo_Binary.jlink +12 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo_FLASH_Debug.jlink +12 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo_RAM_Debug.jlink +12 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/srcIAR/Cstartup.s +299 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/srcIAR/Cstartup_SAM7.c +98 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock.rb +65 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_config.rb +129 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_file_writer.rb +33 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator.rb +195 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_array.rb +57 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_callback.rb +78 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_cexception.rb +51 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_expect.rb +86 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_ignore.rb +95 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_ignore_arg.rb +44 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_return_thru_ptr.rb +74 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_utils.rb +202 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_header_parser.rb +277 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_plugin_manager.rb +40 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_unityhelper_parser.rb +75 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/release/build.info +2 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/release/version.info +2 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/src/cmock.c +176 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/src/cmock.h +31 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/src/cmock_internals.h +43 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/targets/gcc.yml +53 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/targets/iar_arm_v4.yml +108 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/targets/iar_arm_v5.yml +93 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/History.md +27 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/Makefile +8 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/Readme.md +103 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/package.json +9 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/src/commander.c +250 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/src/commander.h +88 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/test.c +34 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/colour_prompt.rb +94 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/colour_reporter.rb +39 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/generate_config.yml +36 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/generate_module.rb +202 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/generate_test_runner.rb +316 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/test_file_filter.rb +23 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/unity_test_summary.rb +139 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/docs/Unity Summary.odt +0 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/docs/Unity Summary.pdf +0 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/docs/Unity Summary.txt +216 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/docs/license.txt +31 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/release/build.info +2 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/release/version.info +2 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/src/unity.c +1146 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/src/unity.h +245 -0
- data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/src/unity_internals.h +546 -0
- data/vendor/project_acpc_server/net.c +0 -0
- data/vendor/project_acpc_server/net.h +1 -0
- data/vendor/project_acpc_server/tags +298 -0
- metadata +158 -26
@@ -0,0 +1,107 @@
|
|
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} 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
|
+
|
45
|
+
#define KAPPA (1/24.0)
|
46
|
+
|
47
|
+
static const int SUB_FAMILY_1_INDEPENDENT_PARAMS[] = {
|
48
|
+
B11_INDEX, B21_INDEX, B32_INDEX, C33_INDEX, C34_INDEX
|
49
|
+
};
|
50
|
+
|
51
|
+
static const int SUB_FAMILY_2_INDEPENDENT_PARAMS[] = {
|
52
|
+
B11_INDEX, B21_INDEX, B23_INDEX, B32_INDEX, C33_INDEX, C34_INDEX
|
53
|
+
};
|
54
|
+
|
55
|
+
static const int SUB_FAMILY_3_INDEPENDENT_PARAMS[] = {
|
56
|
+
B11_INDEX, B32_INDEX, C33_INDEX, C34_INDEX
|
57
|
+
};
|
58
|
+
|
59
|
+
// Necessary params for P1
|
60
|
+
static const double A[][4] = {
|
61
|
+
{0.0, 0.0, 0.0, 0.0},
|
62
|
+
{0.0, 0.0, 0.0, 0.0},
|
63
|
+
{0.0, 0.0, 1/2.0, 0.0},
|
64
|
+
{0.0, 1.0, 1.0, 1.0}
|
65
|
+
};
|
66
|
+
|
67
|
+
// Necessary params for P2
|
68
|
+
#define B12 0.0
|
69
|
+
#define B13 0.0
|
70
|
+
#define B14 0.0
|
71
|
+
#define B22 0.0
|
72
|
+
#define B24 0.0
|
73
|
+
#define B31 0.0
|
74
|
+
#define B34 0.0
|
75
|
+
#define B42 1.0
|
76
|
+
#define B43 1.0
|
77
|
+
#define B44 1.0
|
78
|
+
|
79
|
+
// Necessary params for P3
|
80
|
+
#define C12 0.0
|
81
|
+
#define C13 0.0
|
82
|
+
#define C14 0.0
|
83
|
+
#define C22 0.0
|
84
|
+
#define C23 0.0
|
85
|
+
#define C24 0.0
|
86
|
+
#define C31 0.0
|
87
|
+
#define C32 0.0
|
88
|
+
static const double C4[] = {1.0, 1.0, 1.0, 1.0};
|
89
|
+
|
90
|
+
// Functions -----------------
|
91
|
+
double beta(const Kuhn3pEquilibriumPlayer* kuhn_3p_e_player);
|
92
|
+
Kuhn3pEquilibriumPlayer new_kuhn_3p_equilibrium_player(
|
93
|
+
const Game const* game_def,
|
94
|
+
const double const* params,
|
95
|
+
uint32_t seed
|
96
|
+
);
|
97
|
+
Action action(
|
98
|
+
Kuhn3pEquilibriumPlayer* player,
|
99
|
+
MatchState view
|
100
|
+
);
|
101
|
+
void action_probs(
|
102
|
+
const Kuhn3pEquilibriumPlayer const* player,
|
103
|
+
MatchState view,
|
104
|
+
double* probs
|
105
|
+
);
|
106
|
+
|
107
|
+
#endif
|
@@ -0,0 +1,84 @@
|
|
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
|
+
}
|
@@ -0,0 +1,252 @@
|
|
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, HOST_NAME_MAX * sizeof(*config->dealer.host));
|
161
|
+
strncpy(config->dealer.host, self->arg, HOST_NAME_MAX);
|
162
|
+
}
|
163
|
+
|
164
|
+
static void get_port(command_t *self)
|
165
|
+
{
|
166
|
+
assert(self->data);
|
167
|
+
|
168
|
+
PlayerConfig* config = self->data;
|
169
|
+
|
170
|
+
parse(
|
171
|
+
self->arg,
|
172
|
+
"%"SCNu16,
|
173
|
+
"Invalid port",
|
174
|
+
1,
|
175
|
+
&config->dealer.port
|
176
|
+
);
|
177
|
+
}
|
178
|
+
|
179
|
+
PlayerConfig new_player_config()
|
180
|
+
{
|
181
|
+
// If no random seed is given, initialize the player's random number seed
|
182
|
+
// using time
|
183
|
+
struct timeval tv;
|
184
|
+
gettimeofday(&tv, NULL);
|
185
|
+
rng_state_t rng;
|
186
|
+
init_genrand(&rng, tv.tv_usec);
|
187
|
+
|
188
|
+
PlayerConfig this = {
|
189
|
+
.dealer = new_dealer_connection(),
|
190
|
+
.game = NULL,
|
191
|
+
.params = {0},
|
192
|
+
.seed = genrand_int32(&rng)
|
193
|
+
};
|
194
|
+
|
195
|
+
return this;
|
196
|
+
}
|
197
|
+
|
198
|
+
PlayerConfig new_player_config_from_argv(int argc, char** argv)
|
199
|
+
{
|
200
|
+
command_t cmd;
|
201
|
+
command_init(&cmd, argv[0], "0.0.1");
|
202
|
+
|
203
|
+
command_option(
|
204
|
+
&cmd,
|
205
|
+
"-n",
|
206
|
+
"--host [host name]",
|
207
|
+
"Name of the host on which dealer is running (defaults to 'localhost')",
|
208
|
+
get_host
|
209
|
+
);
|
210
|
+
command_option(
|
211
|
+
&cmd,
|
212
|
+
"-p",
|
213
|
+
"--port <port number>",
|
214
|
+
"Port number to connect to dealer",
|
215
|
+
get_port
|
216
|
+
);
|
217
|
+
command_option(
|
218
|
+
&cmd,
|
219
|
+
"-g",
|
220
|
+
"--game <file name>",
|
221
|
+
"Game definition file name",
|
222
|
+
parse_game_def
|
223
|
+
);
|
224
|
+
command_option(
|
225
|
+
&cmd,
|
226
|
+
"-r",
|
227
|
+
"--seed [non-negative integer]",
|
228
|
+
"Random seed, defaults to a random random seed based on system time.",
|
229
|
+
r
|
230
|
+
);
|
231
|
+
|
232
|
+
command_option(&cmd, "-0", "--c11 <probability>", "C11 value", c11);
|
233
|
+
command_option(&cmd, "-1", "--b11 <probability>", "B11 value", b11);
|
234
|
+
command_option(&cmd, "-2", "--b21 [probability]", "B21 value", b21);
|
235
|
+
command_option(&cmd, "-3", "--b23 [probability]", "B23 value", b23);
|
236
|
+
command_option(&cmd, "-4", "--b32 <probability>", "B32 value", b32);
|
237
|
+
command_option(&cmd, "-8", "--c33 <probability>", "C33 value", c33);
|
238
|
+
command_option(&cmd, "-9", "--c34 <probability>", "C34 value", c34);
|
239
|
+
|
240
|
+
if( argc < 14 ) {
|
241
|
+
command_help(&cmd);
|
242
|
+
exit(EXIT_SUCCESS);
|
243
|
+
}
|
244
|
+
|
245
|
+
PlayerConfig config = new_player_config();
|
246
|
+
cmd.data = &config;
|
247
|
+
|
248
|
+
command_parse(&cmd, argc, argv);
|
249
|
+
command_free(&cmd);
|
250
|
+
|
251
|
+
return config;
|
252
|
+
}
|
@@ -0,0 +1,21 @@
|
|
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
|