acpc_dealer 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. data/README.md +33 -0
  2. data/Rakefile +20 -0
  3. data/acpc_dealer.gemspec +29 -0
  4. data/bin/acpc_dealer +168 -0
  5. data/ext/hand_evaluator/extconf.rb +5 -0
  6. data/ext/hand_evaluator/hand_evaluator.c +38 -0
  7. data/lib/acpc_dealer/2p.limit.h5.r0.logs/2p.limit.h5.r0.actions.log +5 -0
  8. data/lib/acpc_dealer/2p.limit.h5.r0.logs/2p.limit.h5.r0.log +0 -0
  9. data/lib/acpc_dealer/dealer_runner.rb +72 -0
  10. data/lib/acpc_dealer/version.rb +3 -0
  11. data/lib/acpc_dealer.rb +33 -0
  12. data/lib/hand_evaluator.so +0 -0
  13. data/spec/coverage/assets/0.5.3/app.js +88 -0
  14. data/spec/coverage/assets/0.5.3/fancybox/blank.gif +0 -0
  15. data/spec/coverage/assets/0.5.3/fancybox/fancy_close.png +0 -0
  16. data/spec/coverage/assets/0.5.3/fancybox/fancy_loading.png +0 -0
  17. data/spec/coverage/assets/0.5.3/fancybox/fancy_nav_left.png +0 -0
  18. data/spec/coverage/assets/0.5.3/fancybox/fancy_nav_right.png +0 -0
  19. data/spec/coverage/assets/0.5.3/fancybox/fancy_shadow_e.png +0 -0
  20. data/spec/coverage/assets/0.5.3/fancybox/fancy_shadow_n.png +0 -0
  21. data/spec/coverage/assets/0.5.3/fancybox/fancy_shadow_ne.png +0 -0
  22. data/spec/coverage/assets/0.5.3/fancybox/fancy_shadow_nw.png +0 -0
  23. data/spec/coverage/assets/0.5.3/fancybox/fancy_shadow_s.png +0 -0
  24. data/spec/coverage/assets/0.5.3/fancybox/fancy_shadow_se.png +0 -0
  25. data/spec/coverage/assets/0.5.3/fancybox/fancy_shadow_sw.png +0 -0
  26. data/spec/coverage/assets/0.5.3/fancybox/fancy_shadow_w.png +0 -0
  27. data/spec/coverage/assets/0.5.3/fancybox/fancy_title_left.png +0 -0
  28. data/spec/coverage/assets/0.5.3/fancybox/fancy_title_main.png +0 -0
  29. data/spec/coverage/assets/0.5.3/fancybox/fancy_title_over.png +0 -0
  30. data/spec/coverage/assets/0.5.3/fancybox/fancy_title_right.png +0 -0
  31. data/spec/coverage/assets/0.5.3/fancybox/fancybox-x.png +0 -0
  32. data/spec/coverage/assets/0.5.3/fancybox/fancybox-y.png +0 -0
  33. data/spec/coverage/assets/0.5.3/fancybox/fancybox.png +0 -0
  34. data/spec/coverage/assets/0.5.3/fancybox/jquery.fancybox-1.3.1.css +363 -0
  35. data/spec/coverage/assets/0.5.3/fancybox/jquery.fancybox-1.3.1.pack.js +44 -0
  36. data/spec/coverage/assets/0.5.3/favicon_green.png +0 -0
  37. data/spec/coverage/assets/0.5.3/favicon_red.png +0 -0
  38. data/spec/coverage/assets/0.5.3/favicon_yellow.png +0 -0
  39. data/spec/coverage/assets/0.5.3/highlight.css +129 -0
  40. data/spec/coverage/assets/0.5.3/highlight.pack.js +1 -0
  41. data/spec/coverage/assets/0.5.3/jquery-1.6.2.min.js +18 -0
  42. data/spec/coverage/assets/0.5.3/jquery.dataTables.min.js +152 -0
  43. data/spec/coverage/assets/0.5.3/jquery.timeago.js +141 -0
  44. data/spec/coverage/assets/0.5.3/jquery.url.js +174 -0
  45. data/spec/coverage/assets/0.5.3/loading.gif +0 -0
  46. data/spec/coverage/assets/0.5.3/magnify.png +0 -0
  47. data/spec/coverage/assets/0.5.3/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  48. data/spec/coverage/assets/0.5.3/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  49. data/spec/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  50. data/spec/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  51. data/spec/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  52. data/spec/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  53. data/spec/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  54. data/spec/coverage/assets/0.5.3/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  55. data/spec/coverage/assets/0.5.3/smoothness/images/ui-icons_222222_256x240.png +0 -0
  56. data/spec/coverage/assets/0.5.3/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  57. data/spec/coverage/assets/0.5.3/smoothness/images/ui-icons_454545_256x240.png +0 -0
  58. data/spec/coverage/assets/0.5.3/smoothness/images/ui-icons_888888_256x240.png +0 -0
  59. data/spec/coverage/assets/0.5.3/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  60. data/spec/coverage/assets/0.5.3/smoothness/jquery-ui-1.8.4.custom.css +295 -0
  61. data/spec/coverage/assets/0.5.3/stylesheet.css +383 -0
  62. data/spec/coverage/index.html +81 -0
  63. data/spec/dealer_runner_spec.rb +83 -0
  64. data/spec/support/spec_helper.rb +33 -0
  65. data/vendor/project_acpc_server/LICENCE +23 -0
  66. data/vendor/project_acpc_server/Makefile +22 -0
  67. data/vendor/project_acpc_server/README +113 -0
  68. data/vendor/project_acpc_server/README.submission +42 -0
  69. data/vendor/project_acpc_server/acpc_play_match.pl +101 -0
  70. data/vendor/project_acpc_server/bm_server +0 -0
  71. data/vendor/project_acpc_server/bm_server.c +1557 -0
  72. data/vendor/project_acpc_server/bm_server.config +78 -0
  73. data/vendor/project_acpc_server/bm_widget +0 -0
  74. data/vendor/project_acpc_server/bm_widget.c +186 -0
  75. data/vendor/project_acpc_server/dealer +0 -0
  76. data/vendor/project_acpc_server/dealer.c +1278 -0
  77. data/vendor/project_acpc_server/evalHandTables +4269 -0
  78. data/vendor/project_acpc_server/example_player +0 -0
  79. data/vendor/project_acpc_server/example_player.c +204 -0
  80. data/vendor/project_acpc_server/example_player.limit.2p.sh +2 -0
  81. data/vendor/project_acpc_server/example_player.limit.3p.sh +2 -0
  82. data/vendor/project_acpc_server/example_player.nolimit.2p.sh +2 -0
  83. data/vendor/project_acpc_server/example_player.nolimit.3p.sh +2 -0
  84. data/vendor/project_acpc_server/game.c +1793 -0
  85. data/vendor/project_acpc_server/game.h +253 -0
  86. data/vendor/project_acpc_server/holdem.limit.2p.reverse_blinds.game +13 -0
  87. data/vendor/project_acpc_server/holdem.limit.3p.game +13 -0
  88. data/vendor/project_acpc_server/holdem.nolimit.2p.reverse_blinds.game +12 -0
  89. data/vendor/project_acpc_server/holdem.nolimit.3p.game +12 -0
  90. data/vendor/project_acpc_server/net.c +218 -0
  91. data/vendor/project_acpc_server/net.h +61 -0
  92. data/vendor/project_acpc_server/play_match.pl +99 -0
  93. data/vendor/project_acpc_server/protocol.odt +0 -0
  94. data/vendor/project_acpc_server/protocol.pdf +0 -0
  95. data/vendor/project_acpc_server/rng.c +138 -0
  96. data/vendor/project_acpc_server/rng.h +63 -0
  97. data/vendor/project_acpc_server/test.log +11 -0
  98. data/vendor/project_acpc_server/validate_submission.pl +546 -0
  99. metadata +315 -0
@@ -0,0 +1,138 @@
1
+ /*
2
+ A C-program for MT19937, with initialization improved 2002/1/26.
3
+ Coded by Takuji Nishimura and Makoto Matsumoto.
4
+
5
+ Before using, initialize the state by using init_genrand(seed)
6
+ or init_by_array(init_key, key_length).
7
+
8
+ Copyright (C) 2011 by the Computer Poker Research Group, University of
9
+ Alberta
10
+
11
+ This file is a modification of work by Makoto Matsumoto and Takuji
12
+ Nishimura. That work was provided with the following license:
13
+
14
+ Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
15
+ All rights reserved.
16
+
17
+ Redistribution and use in source and binary forms, with or without
18
+ modification, are permitted provided that the following conditions
19
+ are met:
20
+
21
+ 1. Redistributions of source code must retain the above copyright
22
+ notice, this list of conditions and the following disclaimer.
23
+
24
+ 2. Redistributions in binary form must reproduce the above copyright
25
+ notice, this list of conditions and the following disclaimer in the
26
+ documentation and/or other materials provided with the distribution.
27
+
28
+ 3. The names of its contributors may not be used to endorse or promote
29
+ products derived from this software without specific prior written
30
+ permission.
31
+
32
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
35
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
36
+ OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
37
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
38
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
39
+ OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
40
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
41
+ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
42
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43
+
44
+
45
+ Any feedback is very welcome.
46
+ http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
47
+ email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)
48
+ */
49
+
50
+ #include "rng.h"
51
+
52
+ /* NOTE changes made on 2005/9/7 by Neil Burch - if you have problems
53
+ with this code, DON'T complain to Makoto Matsumoto... */
54
+
55
+
56
+ /* initializes mt[N] with a seed */
57
+ void init_genrand( rng_state_t *state, uint32_t s )
58
+ {
59
+ state->mt[0]= s & 0xffffffffUL;
60
+ for (state->mti=1; state->mti<N; state->mti++) {
61
+ state->mt[state->mti] =
62
+ (1812433253UL * (state->mt[state->mti-1]
63
+ ^ (state->mt[state->mti-1] >> 30))
64
+ + state->mti);
65
+ /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */
66
+ /* In the previous versions, MSBs of the seed affect */
67
+ /* only MSBs of the array mt[]. */
68
+ /* 2002/01/09 modified by Makoto Matsumoto */
69
+ }
70
+ }
71
+
72
+ /* initialize by an array with array-length */
73
+ /* init_key is the array for initializing keys */
74
+ /* key_length is its length */
75
+ /* slight change for C++, 2004/2/26 */
76
+ void init_by_array( rng_state_t *state, uint32_t init_key[], int key_length )
77
+ {
78
+ int i, j, k;
79
+
80
+ init_genrand(state, 19650218UL);
81
+ i=1; j=0;
82
+ k = (N>key_length ? N : key_length);
83
+ for (; k; k--) {
84
+ state->mt[i] = ( state->mt[i]
85
+ ^ ( ( state->mt[i-1] ^ ( state->mt[i-1] >> 30 ) )
86
+ * 1664525UL ) )
87
+ + init_key[j] + j; /* non linear */
88
+ i++; j++;
89
+ if (i>=N) { state->mt[0] = state->mt[N-1]; i=1; }
90
+ if (j>=key_length) j=0;
91
+ }
92
+ for (k=N-1; k; k--) {
93
+ state->mt[i] = ( state->mt[i]
94
+ ^ ( ( state->mt[i-1] ^ ( state->mt[i-1] >> 30 ) )
95
+ * 1566083941UL ) )
96
+ - i; /* non linear */
97
+ state->mt[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */
98
+ i++;
99
+ if (i>=N) { state->mt[0] = state->mt[N-1]; i=1; }
100
+ }
101
+
102
+ state->mt[0]|= 0x80000000UL; /* MSB is 1; assuring non-zero initial array */
103
+ }
104
+
105
+ /* generates a random number on [0,0xffffffff]-interval */
106
+ uint32_t genrand_int32( rng_state_t *state )
107
+ {
108
+ uint32_t y;
109
+ static uint32_t mag01[2]={0x0UL, MATRIX_A};
110
+ /* mag01[x] = x * MATRIX_A for x=0,1 */
111
+
112
+ if (state->mti == N) { /* generate N words at one time */
113
+ int kk;
114
+
115
+ for (kk=0;kk<N-M;kk++) {
116
+ y = (state->mt[kk]&UPPER_MASK)|(state->mt[kk+1]&LOWER_MASK);
117
+ state->mt[kk] = state->mt[kk+M] ^ (y >> 1) ^ mag01[y & 0x1UL];
118
+ }
119
+ for (;kk<N-1;kk++) {
120
+ y = (state->mt[kk]&UPPER_MASK)|(state->mt[kk+1]&LOWER_MASK);
121
+ state->mt[kk] = state->mt[kk+(M-N)] ^ (y >> 1) ^ mag01[y & 0x1UL];
122
+ }
123
+ y = (state->mt[N-1]&UPPER_MASK)|(state->mt[0]&LOWER_MASK);
124
+ state->mt[N-1] = state->mt[M-1] ^ (y >> 1) ^ mag01[y & 0x1UL];
125
+
126
+ state->mti = 0;
127
+ }
128
+
129
+ y = state->mt[state->mti++];
130
+
131
+ /* Tempering */
132
+ y ^= (y >> 11);
133
+ y ^= (y << 7) & 0x9d2c5680UL;
134
+ y ^= (y << 15) & 0xefc60000UL;
135
+ y ^= (y >> 18);
136
+
137
+ return y;
138
+ }
@@ -0,0 +1,63 @@
1
+ /*
2
+ Copyright (C) 2011 by the Computer Poker Research Group, University of
3
+ Alberta
4
+ Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
5
+ All rights reserved.
6
+ */
7
+
8
+ #ifndef _RNG_H
9
+ #define _RNG_H
10
+ #define __STDC_FORMAT_MACROS
11
+ #include <inttypes.h>
12
+
13
+
14
+ /* functions included in Takuji Nishimura and Makoto Matsumoto's RNG code */
15
+ /* NOTE changes made on 2005/9/7 by Neil Burch - if you have problems
16
+ with this code, DON'T complain to Makoto Matsumoto... */
17
+
18
+
19
+ /* Period parameters */
20
+ #define N 624
21
+ #define M 397
22
+ #define MATRIX_A 0x9908b0dfUL /* constant vector a */
23
+ #define UPPER_MASK 0x80000000UL /* most significant w-r bits */
24
+ #define LOWER_MASK 0x7fffffffUL /* least significant r bits */
25
+
26
+
27
+ typedef struct {
28
+ uint32_t mt[ N ];
29
+ int mti;
30
+ } rng_state_t;
31
+
32
+
33
+ /* initializes rng state using an integer seed */
34
+ void init_genrand( rng_state_t *state, uint32_t s );
35
+
36
+ /* initialize by an array with array-length */
37
+ /* init_key is the array for initializing keys */
38
+ /* key_length is its length */
39
+ void init_by_array( rng_state_t *state, uint32_t init_key[], int key_length );
40
+
41
+
42
+ /* all of the functions below can not be called until init_* has been called */
43
+
44
+ /* generates a random number on [0,0xffffffff]-interval */
45
+ uint32_t genrand_int32( rng_state_t *state );
46
+
47
+ /* generates a random number on [0,0xffffffff]-interval */
48
+ #define genrand_int31(state) ((int32_t)(genrand_int32(state)>>1))
49
+
50
+ /* These real versions are due to Isaku Wada, 2002/01/09 added */
51
+ /* generates a random number on [0,1]-real-interval */
52
+ #define genrand_real1(state) (genrand_int32(state)*(1.0/4294967295.0))
53
+
54
+ /* generates a random number on [0,1)-real-interval */
55
+ #define genrand_real2(state) (genrand_int32(state)*(1.0/4294967296.0))
56
+
57
+ /* generates a random number on (0,1)-real-interval */
58
+ #define genrand_real3(state) ((((double)genrand_int32(state))+0.5)*(1.0/4294967296.0))
59
+
60
+ /* generates a random number on [0,1) with 53-bit resolution*/
61
+ #define genrand_res53(state) (((genrand_int32(state)>>5)*67108864.0+(genrand_int32(state)>>6))*(1.0/9007199254740992.0))
62
+
63
+ #endif
@@ -0,0 +1,11 @@
1
+ # name/game/hands/seed test holdem.limit.2p.reverse_blinds.game 2 0
2
+ #--t_response 600000
3
+ #--t_hand 600000
4
+ #--t_per_hand 7000
5
+ STATE:0:rc/rrc/crc/rrrc:5d5c|9hQd/8dAs8s/4h/6d:120|-120:p1|p2
6
+ STATE:1:rc/cc/rrc/crc:6sKs|5dJd/2sTh2h/Qh/8h:80|-80:p2|p1
7
+ FINISHED GAME LOOP BEFORE PRINT FINAL MESSAGE
8
+ IN PRINT FINAL MESSAGE
9
+ SCORE:40|-40:p1|p2
10
+ EXITING GAME LOOP
11
+ FLUSHING LOG FILE