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.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/Brickfile +6 -0
  3. data/README.md +7 -6
  4. data/Rakefile +30 -14
  5. data/acpc_dealer.gemspec +2 -1
  6. data/bin/acpc_dealer +4 -0
  7. data/ext/hand_evaluator/extconf.rb +10 -0
  8. data/lib/acpc_dealer/version.rb +1 -1
  9. data/lib/hand_evaluator.bundle +0 -0
  10. data/spec/dealer_runner_spec.rb +76 -72
  11. metadata +19 -82
  12. data/vendor/project_acpc_server/LICENCE +0 -23
  13. data/vendor/project_acpc_server/Makefile +0 -35
  14. data/vendor/project_acpc_server/README +0 -113
  15. data/vendor/project_acpc_server/README.submission +0 -42
  16. data/vendor/project_acpc_server/acpc_play_match.pl +0 -101
  17. data/vendor/project_acpc_server/bm_run_matches.c +0 -238
  18. data/vendor/project_acpc_server/bm_server.c +0 -1604
  19. data/vendor/project_acpc_server/bm_server.config +0 -78
  20. data/vendor/project_acpc_server/bm_widget.c +0 -230
  21. data/vendor/project_acpc_server/dealer.c +0 -1293
  22. data/vendor/project_acpc_server/evalHandTables +0 -4269
  23. data/vendor/project_acpc_server/example_player.c +0 -204
  24. data/vendor/project_acpc_server/example_player.limit.2p.sh +0 -3
  25. data/vendor/project_acpc_server/example_player.limit.3p.sh +0 -3
  26. data/vendor/project_acpc_server/example_player.nolimit.2p.sh +0 -3
  27. data/vendor/project_acpc_server/example_player.nolimit.3p.sh +0 -3
  28. data/vendor/project_acpc_server/game.c +0 -1792
  29. data/vendor/project_acpc_server/game.h +0 -253
  30. data/vendor/project_acpc_server/holdem.limit.2p.reverse_blinds.game +0 -13
  31. data/vendor/project_acpc_server/holdem.limit.3p.game +0 -13
  32. data/vendor/project_acpc_server/holdem.nolimit.2p.reverse_blinds.game +0 -12
  33. data/vendor/project_acpc_server/holdem.nolimit.3p.game +0 -12
  34. data/vendor/project_acpc_server/kuhn.limit.3p.game +0 -14
  35. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player.sf1.sh +0 -3
  36. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player.sf2.sh +0 -3
  37. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player.sf3.sh +0 -3
  38. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/LICENCE +0 -23
  39. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/Makefile +0 -127
  40. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/README.md +0 -35
  41. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/CExceptionConfig.h +0 -12
  42. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/dealer_connection.c +0 -49
  43. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/dealer_connection.h +0 -22
  44. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/kuhn_3p_equilibrium_player.c +0 -483
  45. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/kuhn_3p_equilibrium_player.h +0 -108
  46. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/main.c +0 -84
  47. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/player_config.c +0 -253
  48. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/player_config.h +0 -21
  49. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/support/test_helper.c +0 -45
  50. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/support/test_helper.h +0 -27
  51. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/test_kuhn_3p_equilibrium_player.c +0 -698
  52. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/test_kuhn_3p_equilibrium_player_sub_family_1.c +0 -324
  53. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/test_kuhn_3p_equilibrium_player_sub_family_2.c +0 -262
  54. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/test_kuhn_3p_equilibrium_player_sub_family_3.c +0 -177
  55. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/docs/license.txt +0 -30
  56. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/docs/readme.txt +0 -242
  57. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/lib/CException.c +0 -43
  58. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/lib/CException.h +0 -86
  59. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/release/build.info +0 -2
  60. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/release/version.info +0 -2
  61. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/History.md +0 -27
  62. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/Makefile +0 -8
  63. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/Readme.md +0 -103
  64. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/package.json +0 -9
  65. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/src/commander.c +0 -250
  66. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/src/commander.h +0 -88
  67. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/test.c +0 -34
  68. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/colour_prompt.rb +0 -94
  69. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/colour_reporter.rb +0 -39
  70. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/generate_config.yml +0 -36
  71. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/generate_module.rb +0 -202
  72. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/generate_test_runner.rb +0 -316
  73. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/test_file_filter.rb +0 -23
  74. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/unity_test_summary.rb +0 -139
  75. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/docs/Unity Summary.txt +0 -216
  76. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/docs/license.txt +0 -31
  77. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/release/build.info +0 -2
  78. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/release/version.info +0 -2
  79. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/src/unity.c +0 -1146
  80. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/src/unity.h +0 -245
  81. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/src/unity_internals.h +0 -546
  82. data/vendor/project_acpc_server/net.c +0 -218
  83. data/vendor/project_acpc_server/net.h +0 -62
  84. data/vendor/project_acpc_server/play_match.pl +0 -99
  85. data/vendor/project_acpc_server/protocol.md +0 -239
  86. data/vendor/project_acpc_server/protocol.odt +0 -0
  87. data/vendor/project_acpc_server/protocol.pdf +0 -0
  88. data/vendor/project_acpc_server/rng.c +0 -139
  89. data/vendor/project_acpc_server/rng.h +0 -63
  90. data/vendor/project_acpc_server/validate_submission.pl +0 -546
@@ -1,324 +0,0 @@
1
- /*
2
- Copyright (C) 2013 by the Computer Poker Research Group, University of Alberta
3
- */
4
-
5
- #include <stdio.h>
6
- #include <string.h>
7
- #include <unistd.h>
8
-
9
- #include "test_helper.h"
10
-
11
- #include "kuhn_3p_equilibrium_player.h"
12
-
13
- static int stderr_copy;
14
- static int stderr_copy;
15
- static FILE* dev_null = NULL;
16
- void setUp()
17
- {
18
- // Silence error output
19
- stderr_copy = dup(fileno(stderr));
20
- dev_null = freopen("/dev/null", "w", stderr);
21
- }
22
-
23
- void tearDown()
24
- {
25
- if (dev_null) {
26
- // Restore error output
27
- fflush(stderr);
28
- dup2(stderr_copy, fileno(stderr));
29
- close(stderr_copy);
30
- }
31
- }
32
-
33
- void test_params_set_properly()
34
- {
35
- Game game_def = init_kuhn_poker_game_def();
36
-
37
- double params[NUM_PARAMS] = {0};
38
- params[C11_INDEX] = 0.0;
39
- params[B11_INDEX] = 0.25;
40
- params[B21_INDEX] = 0.25;
41
- params[B32_INDEX] = 0.9375;
42
- params[C33_INDEX] = 0.0;
43
- params[C34_INDEX] = 1.0;
44
-
45
- CEXCEPTION_T e = 0;
46
-
47
- Try
48
- {
49
- Kuhn3pEquilibriumPlayer patient = new_kuhn_3p_equilibrium_player(
50
- &game_def,
51
- params,
52
- 12
53
- );
54
-
55
- TEST_ASSERT_EQUAL_FLOAT(0.0, patient.params[C11_INDEX]);
56
- TEST_ASSERT_EQUAL_FLOAT(0.25, patient.params[B11_INDEX]);
57
- TEST_ASSERT_EQUAL_FLOAT(0.25, patient.params[B21_INDEX]);
58
- TEST_ASSERT_EQUAL_FLOAT(0.9375, patient.params[B32_INDEX]);
59
- TEST_ASSERT_EQUAL_FLOAT(0.0, patient.params[C33_INDEX]);
60
- TEST_ASSERT_EQUAL_FLOAT(1.0, patient.params[C34_INDEX]);
61
- TEST_ASSERT_EQUAL_FLOAT(12, patient.seed);
62
-
63
- TEST_ASSERT_EQUAL_FLOAT(0.0, patient.params[B23_INDEX]);
64
- TEST_ASSERT_EQUAL_FLOAT(
65
- (1 + 0.25 + 2 * 0.25) / 2.0,
66
- patient.params[B33_INDEX]
67
- );
68
- TEST_ASSERT_EQUAL_FLOAT(2 * 0.25 + 2 * 0.25, patient.params[B41_INDEX]);
69
- TEST_ASSERT_EQUAL_FLOAT(1/2.0, patient.params[C21_INDEX]);
70
- }
71
- Catch(e)
72
- {
73
- TEST_FAIL_MESSAGE("Should Not Have Thrown An Error");
74
- }
75
- }
76
-
77
- void test_b21_upper_bound()
78
- {
79
- Game game_def = init_kuhn_poker_game_def();
80
-
81
- double params[NUM_PARAMS] = {0};
82
- params[C11_INDEX] = 0.0;
83
- params[B11_INDEX] = 0.25;
84
- params[B21_INDEX] = 0.26;
85
- params[B32_INDEX] = 0.9375;
86
- params[C33_INDEX] = 0.0;
87
- params[C34_INDEX] = 1.0;
88
-
89
- CEXCEPTION_T e = 0;
90
-
91
- Try
92
- {
93
- Kuhn3pEquilibriumPlayer patient = new_kuhn_3p_equilibrium_player(
94
- &game_def,
95
- params,
96
- 12
97
- );
98
- TEST_FAIL_MESSAGE("Should Have Thrown An Error");
99
- }
100
- Catch(e)
101
- {
102
- TEST_ASSERT_EQUAL(1, e);
103
- }
104
- }
105
-
106
- void test_b11_upper_bound()
107
- {
108
- Game game_def = init_kuhn_poker_game_def();
109
-
110
- double params[NUM_PARAMS] = {0};
111
- params[C11_INDEX] = 0.0;
112
- params[B11_INDEX] = 0.25;
113
- params[B21_INDEX] = 0.24;
114
- params[B32_INDEX] = 0.9375;
115
- params[C33_INDEX] = 0.0;
116
- params[C34_INDEX] = 1.0;
117
-
118
- CEXCEPTION_T e = 0;
119
-
120
- Try
121
- {
122
- Kuhn3pEquilibriumPlayer patient = new_kuhn_3p_equilibrium_player(
123
- &game_def,
124
- params,
125
- 12
126
- );
127
- TEST_FAIL_MESSAGE("Should Have Thrown An Error");
128
- }
129
- Catch(e)
130
- {
131
- TEST_ASSERT_EQUAL(1, e);
132
- }
133
- }
134
-
135
- void test_b32_upper_bound()
136
- {
137
- Game game_def = init_kuhn_poker_game_def();
138
-
139
- double params[NUM_PARAMS] = {0};
140
- params[C11_INDEX] = 0.0;
141
- params[B11_INDEX] = 0.25;
142
- params[B21_INDEX] = 0.25;
143
- params[B32_INDEX] = 0.9376;
144
- params[C33_INDEX] = 0.0;
145
- params[C34_INDEX] = 1.0;
146
-
147
- CEXCEPTION_T e = 0;
148
-
149
- Try
150
- {
151
- Kuhn3pEquilibriumPlayer patient = new_kuhn_3p_equilibrium_player(
152
- &game_def,
153
- params,
154
- 12
155
- );
156
- TEST_FAIL_MESSAGE("Should Have Thrown An Error");
157
- }
158
- Catch(e)
159
- {
160
- TEST_ASSERT_EQUAL(1, e);
161
- }
162
- }
163
-
164
- void test_c33_lower_bound()
165
- {
166
- Game game_def = init_kuhn_poker_game_def();
167
-
168
- double params[NUM_PARAMS] = {0};
169
- params[C11_INDEX] = 0.0;
170
- params[B11_INDEX] = 0.25;
171
- params[B21_INDEX] = 0.25;
172
- params[B32_INDEX] = 0.4;
173
- params[C33_INDEX] = 0.098;
174
- params[C34_INDEX] = 1.0;
175
-
176
- CEXCEPTION_T e = 0;
177
-
178
- Try
179
- {
180
- Kuhn3pEquilibriumPlayer patient = new_kuhn_3p_equilibrium_player(
181
- &game_def,
182
- params,
183
- 12
184
- );
185
- TEST_FAIL_MESSAGE("Should Have Thrown An Error");
186
- }
187
- Catch(e)
188
- {
189
- TEST_ASSERT_EQUAL(1, e);
190
- }
191
- }
192
-
193
- void test_c33_upper_bound()
194
- {
195
- Game game_def = init_kuhn_poker_game_def();
196
-
197
- double params[NUM_PARAMS] = {0};
198
- params[C11_INDEX] = 0.0;
199
- params[B11_INDEX] = 0.25;
200
- params[B21_INDEX] = 0.25;
201
- params[B32_INDEX] = 0.4;
202
- params[C33_INDEX] = 0.54;
203
- params[C34_INDEX] = 0.0;
204
-
205
- CEXCEPTION_T e = 0;
206
-
207
- Try
208
- {
209
- Kuhn3pEquilibriumPlayer patient = new_kuhn_3p_equilibrium_player(
210
- &game_def,
211
- params,
212
- 12
213
- );
214
- TEST_FAIL_MESSAGE("Should Have Thrown An Error");
215
- }
216
- Catch(e)
217
- {
218
- TEST_ASSERT_EQUAL(1, e);
219
- }
220
- }
221
-
222
- void test_a24()
223
- {
224
- Game game_def = init_kuhn_poker_game_def();
225
-
226
- double params[NUM_PARAMS] = {0};
227
- params[C11_INDEX] = 0.0;
228
- params[B11_INDEX] = 0.25;
229
- params[B21_INDEX] = 0.25;
230
- params[B32_INDEX] = 0.9375;
231
- params[C33_INDEX] = 0.0;
232
- params[C34_INDEX] = 1.0;
233
-
234
- CEXCEPTION_T e = 0;
235
-
236
- Try
237
- {
238
- Kuhn3pEquilibriumPlayer patient = new_kuhn_3p_equilibrium_player(
239
- &game_def,
240
- params,
241
- 12
242
- );
243
-
244
- size_t num_actions = 3;
245
-
246
- double probs[NUM_ACTION_TYPES];
247
- memset(probs, -1, NUM_ACTION_TYPES * sizeof(*probs));
248
-
249
- enum ActionType actions[] = {a_call, a_raise, a_call};
250
-
251
- uint8_t card = QUEEN;
252
-
253
- action_probs(
254
- &patient,
255
- init_match_state(
256
- &game_def,
257
- A_POSITION,
258
- card,
259
- actions,
260
- num_actions
261
- ),
262
- probs
263
- );
264
- TEST_ASSERT_EQUAL_FLOAT(1.0, probs[a_fold]);
265
- TEST_ASSERT_EQUAL_FLOAT(0.0, probs[a_call]);
266
- TEST_ASSERT_EQUAL_FLOAT(0.0, probs[a_raise]);
267
- }
268
- Catch(e)
269
- {
270
- TEST_FAIL_MESSAGE("Should Not Have Thrown An Error");
271
- }
272
- }
273
-
274
- void test_a41()
275
- {
276
- Game game_def = init_kuhn_poker_game_def();
277
-
278
- double params[NUM_PARAMS] = {0};
279
- params[C11_INDEX] = 0.0;
280
- params[B11_INDEX] = 0.25;
281
- params[B21_INDEX] = 0.25;
282
- params[B32_INDEX] = 0.9375;
283
- params[C33_INDEX] = 0.0;
284
- params[C34_INDEX] = 1.0;
285
-
286
- CEXCEPTION_T e = 0;
287
-
288
- Try
289
- {
290
- Kuhn3pEquilibriumPlayer patient = new_kuhn_3p_equilibrium_player(
291
- &game_def,
292
- params,
293
- 12
294
- );
295
-
296
- double probs[NUM_ACTION_TYPES];
297
- memset(probs, -1, NUM_ACTION_TYPES * sizeof(*probs));
298
-
299
- size_t num_actions = 0;
300
- enum ActionType actions[] = {};
301
-
302
- uint8_t card = ACE;
303
-
304
- action_probs(
305
- &patient,
306
- init_match_state(
307
- &game_def,
308
- A_POSITION,
309
- card,
310
- actions,
311
- num_actions
312
- ),
313
- probs
314
- );
315
-
316
- TEST_ASSERT_EQUAL_FLOAT(0.0, probs[a_fold]);
317
- TEST_ASSERT_EQUAL_FLOAT(1.0, probs[a_call]);
318
- TEST_ASSERT_EQUAL_FLOAT(0.0, probs[a_raise]);
319
- }
320
- Catch(e)
321
- {
322
- TEST_FAIL_MESSAGE("Should Not Have Thrown An Error");
323
- }
324
- }
@@ -1,262 +0,0 @@
1
- /*
2
- Copyright (C) 2013 by the Computer Poker Research Group, University of Alberta
3
- */
4
-
5
- #include <stdio.h>
6
- #include <string.h>
7
- #include <unistd.h>
8
-
9
- #include "test_helper.h"
10
-
11
- #include "kuhn_3p_equilibrium_player.h"
12
-
13
- static int stderr_copy;
14
- static FILE* dev_null = NULL;
15
- void setUp()
16
- {
17
- // Silence error output
18
- stderr_copy = dup(fileno(stderr));
19
- dev_null = freopen("/dev/null", "w", stderr);
20
- }
21
-
22
- void tearDown()
23
- {
24
- if (dev_null) {
25
- // Restore error output
26
- fflush(stderr);
27
- dup2(stderr_copy, fileno(stderr));
28
- close(stderr_copy);
29
- }
30
- }
31
-
32
- void test_params_set_properly()
33
- {
34
- Game game_def = init_kuhn_poker_game_def();
35
-
36
- double params[NUM_PARAMS] = {0};
37
- params[C11_INDEX] = 0.5;
38
- params[B11_INDEX] = 0.25;
39
- params[B21_INDEX] = 1/2.0 - 2 * params[B11_INDEX];
40
- params[B23_INDEX] = (params[B11_INDEX] - params[B21_INDEX]) /
41
- (2 * (1 - params[B21_INDEX]));
42
- params[B32_INDEX] = (2 + 4*params[B11_INDEX] + 3 * params[B21_INDEX]) / 4.0;
43
- params[C33_INDEX] = 1/2.0 - params[B32_INDEX] +
44
- (4 * params[B11_INDEX] + 3 * params[B21_INDEX]) / 4.0;
45
- params[C34_INDEX] = 3/4.0; // Unconstrained
46
-
47
- double b33 = (1.0 + params[B11_INDEX] + 2 * params[B21_INDEX]) / 2.0;
48
- double b41 = 2 * (params[B11_INDEX] + params[B21_INDEX]);
49
-
50
- CEXCEPTION_T e = 0;
51
-
52
- Try
53
- {
54
- Kuhn3pEquilibriumPlayer patient = new_kuhn_3p_equilibrium_player(
55
- &game_def,
56
- params,
57
- 12
58
- );
59
-
60
- TEST_ASSERT_EQUAL_FLOAT(params[C11_INDEX], patient.params[C11_INDEX]);
61
- TEST_ASSERT_EQUAL_FLOAT(params[B11_INDEX], patient.params[B11_INDEX]);
62
- TEST_ASSERT_EQUAL_FLOAT(params[B21_INDEX], patient.params[B21_INDEX]);
63
- TEST_ASSERT_EQUAL_FLOAT(params[B23_INDEX], patient.params[B23_INDEX]);
64
- TEST_ASSERT_EQUAL_FLOAT(params[B32_INDEX], patient.params[B32_INDEX]);
65
- TEST_ASSERT_EQUAL_FLOAT(params[C33_INDEX], patient.params[C33_INDEX]);
66
- TEST_ASSERT_EQUAL_FLOAT(params[C34_INDEX], patient.params[C34_INDEX]);
67
-
68
- TEST_ASSERT_EQUAL_FLOAT(12, patient.seed);
69
-
70
- TEST_ASSERT_EQUAL_FLOAT(b33, patient.params[B33_INDEX]);
71
- TEST_ASSERT_EQUAL_FLOAT(b41, patient.params[B41_INDEX]);
72
- TEST_ASSERT_EQUAL_FLOAT(0.0, patient.params[C21_INDEX]);
73
- }
74
- Catch(e)
75
- {
76
- TEST_FAIL_MESSAGE("Should Not Have Thrown An Error");
77
- }
78
- }
79
-
80
- void test_b21()
81
- {
82
- Game game_def = init_kuhn_poker_game_def();
83
-
84
- double params[NUM_PARAMS] = {0};
85
- params[C11_INDEX] = 0.5;
86
- params[B11_INDEX] = 1/4.0;
87
- params[B21_INDEX] = 1/2.0 - 2 * params[B11_INDEX] + 0.01;
88
- params[B23_INDEX] = (params[B11_INDEX] - params[B21_INDEX]) /
89
- (2 * (1 - params[B21_INDEX]));
90
- params[B32_INDEX] = (2 + 4*params[B11_INDEX] + 3 * params[B21_INDEX]) / 4.0;
91
- params[C33_INDEX] = 1/2.0 - params[B32_INDEX] +
92
- (4 * params[B11_INDEX] + 3 * params[B21_INDEX]) / 4.0;
93
-
94
- CEXCEPTION_T e = 0;
95
-
96
- Try {
97
- Kuhn3pEquilibriumPlayer patient = new_kuhn_3p_equilibrium_player(
98
- &game_def,
99
- params,
100
- 12
101
- );
102
- TEST_FAIL_MESSAGE("Should Have Thrown An Error");
103
- }
104
- Catch(e) {
105
- TEST_ASSERT_EQUAL(1, e);
106
- }
107
-
108
- params[B11_INDEX] = 1/6.0;
109
- params[B21_INDEX] = params[B11_INDEX] + 0.01;
110
- params[B23_INDEX] = (params[B11_INDEX] - params[B21_INDEX]) /
111
- (2 * (1 - params[B21_INDEX]));
112
- params[B32_INDEX] = (2 + 4*params[B11_INDEX] + 3 * params[B21_INDEX]) / 4.0;
113
- params[C33_INDEX] = 1/2.0 - params[B32_INDEX] +
114
- (4 * params[B11_INDEX] + 3 * params[B21_INDEX]) / 4.0;
115
-
116
- Try {
117
- Kuhn3pEquilibriumPlayer patient = new_kuhn_3p_equilibrium_player(
118
- &game_def,
119
- params,
120
- 12
121
- );
122
- TEST_FAIL_MESSAGE("Should Have Thrown An Error");
123
- }
124
- Catch(e) {
125
- TEST_ASSERT_EQUAL(1, e);
126
- }
127
- }
128
-
129
- void test_b11_upper_bound()
130
- {
131
- Game game_def = init_kuhn_poker_game_def();
132
-
133
- double params[NUM_PARAMS] = {0};
134
- params[C11_INDEX] = 0.5;
135
- params[B11_INDEX] = 0.26;
136
- params[B21_INDEX] = 1/2.0 - 2 * params[B11_INDEX];
137
- params[B23_INDEX] = (params[B11_INDEX] - params[B21_INDEX]) /
138
- (2 * (1 - params[B21_INDEX]));
139
- params[B32_INDEX] = (2 + 4*params[B11_INDEX] + 3 * params[B21_INDEX]) / 4.0;
140
- params[C33_INDEX] = 1/2.0 - params[B32_INDEX] +
141
- (4 * params[B11_INDEX] + 3 * params[B21_INDEX]) / 4.0;
142
-
143
- CEXCEPTION_T e = 0;
144
-
145
- Try {
146
- Kuhn3pEquilibriumPlayer patient = new_kuhn_3p_equilibrium_player(
147
- &game_def,
148
- params,
149
- 12
150
- );
151
- TEST_FAIL_MESSAGE("Should Have Thrown An Error");
152
- }
153
- Catch(e) {
154
- TEST_ASSERT_EQUAL(1, e);
155
- }
156
- }
157
-
158
- void test_b23_upper_bound()
159
- {
160
- Game game_def = init_kuhn_poker_game_def();
161
-
162
- double params[NUM_PARAMS] = {0};
163
- params[C11_INDEX] = 0.5;
164
- params[B11_INDEX] = 0.25;
165
- params[B21_INDEX] = 1/2.0 - 2 * params[B11_INDEX];
166
- params[B23_INDEX] = (params[B11_INDEX] - params[B21_INDEX]) /
167
- (2 * (1 - params[B21_INDEX])) + 0.01;
168
- params[B32_INDEX] = (2 + 4*params[B11_INDEX] + 3 * params[B21_INDEX]) / 4.0;
169
- params[C33_INDEX] = 1/2.0 - params[B32_INDEX] +
170
- (4 * params[B11_INDEX] + 3 * params[B21_INDEX]) / 4.0;
171
-
172
- CEXCEPTION_T e = 0;
173
-
174
- Try {
175
- Kuhn3pEquilibriumPlayer patient = new_kuhn_3p_equilibrium_player(
176
- &game_def,
177
- params,
178
- 12
179
- );
180
- TEST_FAIL_MESSAGE("Should Have Thrown An Error");
181
- }
182
- Catch(e) {
183
- TEST_ASSERT_EQUAL(1, e);
184
- }
185
- }
186
-
187
- void test_b32_upper_bound()
188
- {
189
- Game game_def = init_kuhn_poker_game_def();
190
-
191
- double params[NUM_PARAMS] = {0};
192
- params[C11_INDEX] = 0.5;
193
- params[B11_INDEX] = 0.25;
194
- params[B21_INDEX] = 1/2.0 - 2 * params[B11_INDEX];
195
- params[B23_INDEX] = (params[B11_INDEX] - params[B21_INDEX]) /
196
- (2 * (1 - params[B21_INDEX]));
197
- params[B32_INDEX] = (2 + 4*params[B11_INDEX] + 3 * params[B21_INDEX]) / 4.0 +
198
- 0.01;
199
- params[C33_INDEX] = 1/2.0 - params[B32_INDEX] +
200
- (4 * params[B11_INDEX] + 3 * params[B21_INDEX]) / 4.0;
201
-
202
- CEXCEPTION_T e = 0;
203
-
204
- Try {
205
- Kuhn3pEquilibriumPlayer patient = new_kuhn_3p_equilibrium_player(
206
- &game_def,
207
- params,
208
- 12
209
- );
210
- TEST_FAIL_MESSAGE("Should Have Thrown An Error");
211
- }
212
- Catch(e) {
213
- TEST_ASSERT_EQUAL(1, e);
214
- }
215
- }
216
-
217
- void test_c33()
218
- {
219
- Game game_def = init_kuhn_poker_game_def();
220
-
221
- double params[NUM_PARAMS] = {0};
222
- params[C11_INDEX] = 0.5;
223
- params[B11_INDEX] = 0.25;
224
- params[B21_INDEX] = 1/2.0 - 2 * params[B11_INDEX];
225
- params[B23_INDEX] = (params[B11_INDEX] - params[B21_INDEX]) /
226
- (2 * (1 - params[B21_INDEX]));
227
- params[B32_INDEX] = (2 + 4*params[B11_INDEX] + 3 * params[B21_INDEX]) / 4.0;
228
-
229
- // Check upper bound
230
- params[C33_INDEX] = 1/2.0 - params[B32_INDEX] +
231
- (4 * params[B11_INDEX] + 3 * params[B21_INDEX]) / 4.0 + 0.01;
232
-
233
- CEXCEPTION_T e = 0;
234
-
235
- Try {
236
- Kuhn3pEquilibriumPlayer patient = new_kuhn_3p_equilibrium_player(
237
- &game_def,
238
- params,
239
- 12
240
- );
241
- TEST_FAIL_MESSAGE("Should Have Thrown An Error");
242
- }
243
- Catch(e) {
244
- TEST_ASSERT_EQUAL(1, e);
245
- }
246
-
247
- // Check lower bound
248
- params[C33_INDEX] = 1/2.0 - params[B32_INDEX] +
249
- (4 * params[B11_INDEX] + 3 * params[B21_INDEX]) / 4.0 - 0.01;
250
-
251
- Try {
252
- Kuhn3pEquilibriumPlayer patient = new_kuhn_3p_equilibrium_player(
253
- &game_def,
254
- params,
255
- 12
256
- );
257
- TEST_FAIL_MESSAGE("Should Have Thrown An Error");
258
- }
259
- Catch(e) {
260
- TEST_ASSERT_EQUAL(1, e);
261
- }
262
- }