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.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +4 -2
  3. data/lib/acpc_dealer.rb +6 -2
  4. data/lib/acpc_dealer/version.rb +1 -1
  5. data/vendor/project_acpc_server/Makefile +12 -2
  6. data/vendor/project_acpc_server/README +1 -0
  7. data/vendor/project_acpc_server/example_player.limit.2p.sh +2 -1
  8. data/vendor/project_acpc_server/example_player.limit.3p.sh +2 -1
  9. data/vendor/project_acpc_server/example_player.nolimit.2p.sh +2 -1
  10. data/vendor/project_acpc_server/example_player.nolimit.3p.sh +2 -1
  11. data/vendor/project_acpc_server/kuhn.limit.3p.game +14 -0
  12. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player.sf1.sh +3 -0
  13. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player.sf2.sh +3 -0
  14. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player.sf3.sh +3 -0
  15. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/LICENCE +23 -0
  16. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/Makefile +128 -0
  17. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/README.md +35 -0
  18. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/CExceptionConfig.h +12 -0
  19. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/dealer_connection.c +49 -0
  20. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/dealer_connection.h +22 -0
  21. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/kuhn_3p_equilibrium_player.c +483 -0
  22. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/kuhn_3p_equilibrium_player.h +107 -0
  23. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/main.c +84 -0
  24. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/player_config.c +252 -0
  25. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/player_config.h +21 -0
  26. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/support/test_helper.c +45 -0
  27. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/support/test_helper.h +27 -0
  28. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/test_kuhn_3p_equilibrium_player.c +698 -0
  29. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/test_kuhn_3p_equilibrium_player_sub_family_1.c +324 -0
  30. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/test_kuhn_3p_equilibrium_player_sub_family_2.c +262 -0
  31. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/test_kuhn_3p_equilibrium_player_sub_family_3.c +177 -0
  32. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/docs/CExceptionSummary.odt +0 -0
  33. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/docs/CExceptionSummary.pdf +0 -0
  34. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/docs/license.txt +30 -0
  35. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/docs/readme.txt +242 -0
  36. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/lib/CException.c +43 -0
  37. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/lib/CException.h +86 -0
  38. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/release/build.info +2 -0
  39. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/release/version.info +2 -0
  40. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/config/production_environment.rb +14 -0
  41. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/config/test_environment.rb +16 -0
  42. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/docs/CMock Summary.odt +0 -0
  43. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/docs/CMock Summary.pdf +0 -0
  44. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/docs/CMock_Summary.md +356 -0
  45. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/docs/license.txt +31 -0
  46. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/SAM7_FLASH.mac +71 -0
  47. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/SAM7_RAM.mac +94 -0
  48. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/SAM7_SIM.mac +67 -0
  49. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_FLASH.xcl +185 -0
  50. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_RAM.xcl +185 -0
  51. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/ioat91sam7x256.ddf +2259 -0
  52. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/cmock_demo.dep +3691 -0
  53. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/cmock_demo.ewd +1696 -0
  54. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/cmock_demo.ewp +2581 -0
  55. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/cmock_demo.eww +10 -0
  56. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X-EK.h +61 -0
  57. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.inc +2314 -0
  58. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.rdf +4704 -0
  59. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.tcl +3407 -0
  60. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256_inc.h +2268 -0
  61. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/ioat91sam7x256.h +4380 -0
  62. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/lib_AT91SAM7X256.h +4211 -0
  63. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/settings/cmock_demo.cspy.bat +32 -0
  64. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/settings/cmock_demo.dbgdt +86 -0
  65. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/settings/cmock_demo.dni +42 -0
  66. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/settings/cmock_demo.wsdt +76 -0
  67. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/srcIAR/Cstartup.s79 +266 -0
  68. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/srcIAR/Cstartup_SAM7.c +98 -0
  69. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/Resource/SAM7_FLASH.mac +71 -0
  70. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/Resource/SAM7_RAM.mac +94 -0
  71. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/Resource/SAM7_SIM.mac +67 -0
  72. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_FLASH.icf +43 -0
  73. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_RAM.icf +42 -0
  74. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/cmock_demo.dep +4204 -0
  75. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/cmock_demo.ewd +1906 -0
  76. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/cmock_demo.ewp +2426 -0
  77. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/cmock_demo.eww +26 -0
  78. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X-EK.h +61 -0
  79. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X256_inc.h +2268 -0
  80. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/incIAR/lib_AT91SAM7X256.h +4211 -0
  81. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/incIAR/project.h +30 -0
  82. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.cspy.bat +33 -0
  83. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dbgdt +5 -0
  84. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dni +18 -0
  85. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.wsdt +74 -0
  86. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X_FLASH_Debug.jlink +12 -0
  87. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo.cspy.bat +33 -0
  88. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo.dbgdt +85 -0
  89. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo.dni +44 -0
  90. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo.wsdt +73 -0
  91. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo_Binary.jlink +12 -0
  92. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo_FLASH_Debug.jlink +12 -0
  93. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo_RAM_Debug.jlink +12 -0
  94. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/srcIAR/Cstartup.s +299 -0
  95. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/srcIAR/Cstartup_SAM7.c +98 -0
  96. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock.rb +65 -0
  97. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_config.rb +129 -0
  98. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_file_writer.rb +33 -0
  99. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator.rb +195 -0
  100. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_array.rb +57 -0
  101. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_callback.rb +78 -0
  102. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_cexception.rb +51 -0
  103. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_expect.rb +86 -0
  104. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_ignore.rb +95 -0
  105. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_ignore_arg.rb +44 -0
  106. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_return_thru_ptr.rb +74 -0
  107. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_utils.rb +202 -0
  108. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_header_parser.rb +277 -0
  109. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_plugin_manager.rb +40 -0
  110. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_unityhelper_parser.rb +75 -0
  111. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/release/build.info +2 -0
  112. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/release/version.info +2 -0
  113. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/src/cmock.c +176 -0
  114. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/src/cmock.h +31 -0
  115. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/src/cmock_internals.h +43 -0
  116. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/targets/gcc.yml +53 -0
  117. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/targets/iar_arm_v4.yml +108 -0
  118. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/targets/iar_arm_v5.yml +93 -0
  119. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/History.md +27 -0
  120. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/Makefile +8 -0
  121. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/Readme.md +103 -0
  122. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/package.json +9 -0
  123. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/src/commander.c +250 -0
  124. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/src/commander.h +88 -0
  125. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/test.c +34 -0
  126. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/colour_prompt.rb +94 -0
  127. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/colour_reporter.rb +39 -0
  128. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/generate_config.yml +36 -0
  129. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/generate_module.rb +202 -0
  130. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/generate_test_runner.rb +316 -0
  131. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/test_file_filter.rb +23 -0
  132. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/unity_test_summary.rb +139 -0
  133. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/docs/Unity Summary.odt +0 -0
  134. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/docs/Unity Summary.pdf +0 -0
  135. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/docs/Unity Summary.txt +216 -0
  136. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/docs/license.txt +31 -0
  137. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/release/build.info +2 -0
  138. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/release/version.info +2 -0
  139. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/src/unity.c +1146 -0
  140. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/src/unity.h +245 -0
  141. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/src/unity_internals.h +546 -0
  142. data/vendor/project_acpc_server/net.c +0 -0
  143. data/vendor/project_acpc_server/net.h +1 -0
  144. data/vendor/project_acpc_server/tags +298 -0
  145. metadata +158 -26
@@ -0,0 +1,324 @@
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
+ }
@@ -0,0 +1,262 @@
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
+ }