acpc_dealer_data 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/.yardopts +7 -0
- data/Gemfile +4 -0
- data/LICENSE.md +17 -0
- data/README.md +45 -0
- data/Rakefile +12 -0
- data/acpc_dealer_data.gemspec +27 -0
- data/lib/acpc_dealer_data.rb +10 -0
- data/lib/acpc_dealer_data/action_messages.rb +90 -0
- data/lib/acpc_dealer_data/hand_data.rb +164 -0
- data/lib/acpc_dealer_data/hand_results.rb +71 -0
- data/lib/acpc_dealer_data/match_definition.rb +56 -0
- data/lib/acpc_dealer_data/poker_match_data.rb +178 -0
- data/lib/acpc_dealer_data/version.rb +3 -0
- data/spec/action_messages_spec.rb +308 -0
- data/spec/hand_data_spec.rb +295 -0
- data/spec/hand_results_spec.rb +231 -0
- data/spec/match_definition_spec.rb +95 -0
- data/spec/poker_match_data_spec.rb +243 -0
- data/spec/support/spec_helper.rb +24 -0
- metadata +189 -0
@@ -0,0 +1,295 @@
|
|
1
|
+
|
2
|
+
# Spec helper (must include first to track code coverage with SimpleCov)
|
3
|
+
require_relative 'support/spec_helper'
|
4
|
+
|
5
|
+
require 'mocha'
|
6
|
+
|
7
|
+
require 'acpc_dealer'
|
8
|
+
require 'acpc_poker_types/match_state'
|
9
|
+
require 'acpc_poker_types/poker_action'
|
10
|
+
|
11
|
+
require_relative '../lib/acpc_dealer_data/action_messages'
|
12
|
+
require_relative '../lib/acpc_dealer_data/hand_data'
|
13
|
+
require_relative '../lib/acpc_dealer_data/hand_results'
|
14
|
+
require_relative '../lib/acpc_dealer_data/match_definition'
|
15
|
+
|
16
|
+
describe HandData do
|
17
|
+
before do
|
18
|
+
@patient = nil
|
19
|
+
@chip_distribution = nil
|
20
|
+
@match_def = nil
|
21
|
+
@current_match_state = nil
|
22
|
+
@last_match_state = nil
|
23
|
+
@turn_number = nil
|
24
|
+
@seat = nil
|
25
|
+
@turn_data = nil
|
26
|
+
@next_action = nil
|
27
|
+
@last_action = nil
|
28
|
+
@final_turn = nil
|
29
|
+
end
|
30
|
+
|
31
|
+
describe 'raises an exception' do
|
32
|
+
it 'if the given action data does not have the proper format' do
|
33
|
+
init_data do |action_data, result|
|
34
|
+
->() do
|
35
|
+
@patient = HandData.new(
|
36
|
+
@match_def,
|
37
|
+
(action_data.data.first + [action_data.data.first.last]).flatten,
|
38
|
+
result.data.first
|
39
|
+
)
|
40
|
+
end.must_raise HandData::InvalidData
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'reports the chip distribution for every seat' do
|
46
|
+
init_data do |action_data, result|
|
47
|
+
@patient = HandData.new @match_def, action_data.data.first, result.data.first
|
48
|
+
|
49
|
+
check_patient
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'works properly on every turn for every seat' do
|
54
|
+
init_data do |action_data, result|
|
55
|
+
@match_def.game_def.number_of_players.times do |seat|
|
56
|
+
@seat = seat
|
57
|
+
|
58
|
+
@last_match_state = nil
|
59
|
+
@current_match_state = nil
|
60
|
+
|
61
|
+
@last_action = nil
|
62
|
+
@next_action = nil
|
63
|
+
|
64
|
+
@patient = HandData.new @match_def, action_data.data.first, result.data.first
|
65
|
+
|
66
|
+
@turn_number = 0
|
67
|
+
@patient.for_every_turn!(@seat) do
|
68
|
+
@final_turn = @turn_number >= @turn_data.length - 1
|
69
|
+
|
70
|
+
@last_match_state = @current_match_state
|
71
|
+
@current_match_state = @turn_data[@turn_number].state_messages[@seat]
|
72
|
+
|
73
|
+
@last_action = @next_action
|
74
|
+
@next_action = @turn_data[@turn_number].action_message
|
75
|
+
|
76
|
+
check_patient
|
77
|
+
|
78
|
+
@turn_number += 1
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def check_patient
|
85
|
+
@patient.chip_distribution.must_equal @chip_distribution
|
86
|
+
@patient.match_def.must_equal @match_def
|
87
|
+
@patient.turn_number.must_equal @turn_number
|
88
|
+
@patient.data.must_equal @turn_data
|
89
|
+
@patient.seat.must_equal @seat
|
90
|
+
@patient.current_match_state.must_equal @current_match_state
|
91
|
+
@patient.last_match_state.must_equal @last_match_state
|
92
|
+
@patient.next_action.must_equal @next_action
|
93
|
+
@patient.last_action.must_equal @last_action
|
94
|
+
@patient.final_turn?.must_equal @final_turn
|
95
|
+
end
|
96
|
+
|
97
|
+
def init_data
|
98
|
+
data.each do |game, data_hash|
|
99
|
+
@chip_distribution = data_hash[:chip_distribution]
|
100
|
+
@turn_data = data_hash[:turn_data]
|
101
|
+
@action_data = ActionMessages.parse(
|
102
|
+
data_hash[:action_messages],
|
103
|
+
data_hash[:player_names],
|
104
|
+
AcpcDealer::DEALER_DIRECTORY
|
105
|
+
)
|
106
|
+
@hand_result = HandResults.parse(
|
107
|
+
data_hash[:result_message],
|
108
|
+
data_hash[:player_names],
|
109
|
+
AcpcDealer::DEALER_DIRECTORY
|
110
|
+
)
|
111
|
+
@match_def = @hand_result.match_def
|
112
|
+
|
113
|
+
yield @action_data, @hand_result
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
def data
|
118
|
+
{
|
119
|
+
two_player_limit: {
|
120
|
+
action_messages: [
|
121
|
+
"# name/game/hands/seed 2p.limit.h1000.r0 holdem.limit.2p.reverse_blinds.game 1000 0\n",
|
122
|
+
"TO 1 at 1341696000.058613 MATCHSTATE:1:999:crc/cc/cc/:|TdQd/As6d6h/7h/4s\n",
|
123
|
+
"TO 2 at 1341696000.058634 MATCHSTATE:0:999:crc/cc/cc/:Jc8d|/As6d6h/7h/4s\n",
|
124
|
+
"FROM 2 at 1341696000.058641 MATCHSTATE:0:999:crc/cc/cc/:Jc8d|/As6d6h/7h/4s:r\n",
|
125
|
+
"TO 1 at 1341696000.058664 MATCHSTATE:1:999:crc/cc/cc/r:|TdQd/As6d6h/7h/4s\n",
|
126
|
+
"TO 2 at 1341696000.058681 MATCHSTATE:0:999:crc/cc/cc/r:Jc8d|/As6d6h/7h/4s\n",
|
127
|
+
"FROM 1 at 1341696000.058688 MATCHSTATE:1:999:crc/cc/cc/r:|TdQd/As6d6h/7h/4s:c\n",
|
128
|
+
"TO 1 at 1341696000.058712 MATCHSTATE:1:999:crc/cc/cc/rc:Jc8d|TdQd/As6d6h/7h/4s\n",
|
129
|
+
"TO 2 at 1341696000.058732 MATCHSTATE:0:999:crc/cc/cc/rc:Jc8d|TdQd/As6d6h/7h/4s\n",
|
130
|
+
"FINISHED at 1341696000.058664\n",
|
131
|
+
'SCORE:455|-455:p1|p2'
|
132
|
+
],
|
133
|
+
result_message: [
|
134
|
+
"# name/game/hands/seed 2p.limit.h1000.r0 holdem.limit.2p.reverse_blinds.game 1000 0\n",
|
135
|
+
"STATE:999:crc/cc/cc/rc:Jc8d|TdQd/As6d6h/7h/4s:-60|60:p2|p1\n"
|
136
|
+
],
|
137
|
+
chip_distribution: [60, -60],
|
138
|
+
player_names: ['p1', 'p2'],
|
139
|
+
turn_data: [
|
140
|
+
HandData::Turn.new(
|
141
|
+
[
|
142
|
+
MatchState.parse('MATCHSTATE:1:999:crc/cc/cc/:|TdQd/As6d6h/7h/4s'),
|
143
|
+
MatchState.parse('MATCHSTATE:0:999:crc/cc/cc/:Jc8d|/As6d6h/7h/4s')
|
144
|
+
],
|
145
|
+
{
|
146
|
+
seat: 1,
|
147
|
+
state: MatchState.parse('MATCHSTATE:0:999:crc/cc/cc/:Jc8d|/As6d6h/7h/4s'),
|
148
|
+
action: PokerAction.new('r')
|
149
|
+
}
|
150
|
+
),
|
151
|
+
HandData::Turn.new(
|
152
|
+
[
|
153
|
+
MatchState.parse('MATCHSTATE:1:999:crc/cc/cc/r:|TdQd/As6d6h/7h/4s'),
|
154
|
+
MatchState.parse('MATCHSTATE:0:999:crc/cc/cc/r:Jc8d|/As6d6h/7h/4s')
|
155
|
+
],
|
156
|
+
{
|
157
|
+
seat: 0,
|
158
|
+
state: MatchState.parse('MATCHSTATE:1:999:crc/cc/cc/r:|TdQd/As6d6h/7h/4s'),
|
159
|
+
action: PokerAction.new('c')
|
160
|
+
}
|
161
|
+
),
|
162
|
+
HandData::Turn.new(
|
163
|
+
[
|
164
|
+
MatchState.parse('MATCHSTATE:1:999:crc/cc/cc/rc:Jc8d|TdQd/As6d6h/7h/4s'),
|
165
|
+
MatchState.parse('MATCHSTATE:0:999:crc/cc/cc/rc:Jc8d|TdQd/As6d6h/7h/4s')
|
166
|
+
],
|
167
|
+
nil
|
168
|
+
)
|
169
|
+
]
|
170
|
+
},
|
171
|
+
two_player_nolimit: {
|
172
|
+
action_messages: [
|
173
|
+
"# name/game/hands/seed 2p.nolimit.h1000.r0 holdem.nolimit.2p.reverse_blinds.game 1000 0\n",
|
174
|
+
"TO 1 at 1341695921.617268 MATCHSTATE:1:999::|TdQd\n",
|
175
|
+
"TO 2 at 1341695921.617309 MATCHSTATE:0:999::Jc8d|\n",
|
176
|
+
"FROM 1 at 1341695921.617324 MATCHSTATE:1:999::|TdQd:f\n",
|
177
|
+
"TO 1 at 1341695921.617377 MATCHSTATE:1:999:f:|TdQd\n",
|
178
|
+
"TO 2 at 1341695921.617415 MATCHSTATE:0:999:f:Jc8d|\n",
|
179
|
+
"FINISHED at 1341695921.617268\n",
|
180
|
+
"SCORE:-64658|64658:p1|p2"
|
181
|
+
],
|
182
|
+
result_message: [
|
183
|
+
"# name/game/hands/seed 2p.nolimit.h1000.r0 holdem.nolimit.2p.reverse_blinds.game 1000 0\n",
|
184
|
+
"STATE:999:crc/cc/cc/rc:Jc8d|TdQd/As6d6h/7h/4s:-19718|19718:p2|p1\n"
|
185
|
+
],
|
186
|
+
chip_distribution: [19718, -19718],
|
187
|
+
player_names: ['p1', 'p2'],
|
188
|
+
turn_data: [
|
189
|
+
HandData::Turn.new(
|
190
|
+
[
|
191
|
+
MatchState.parse('MATCHSTATE:1:999::|TdQd'),
|
192
|
+
MatchState.parse('MATCHSTATE:0:999::Jc8d|')
|
193
|
+
],
|
194
|
+
{
|
195
|
+
seat: 0,
|
196
|
+
state: MatchState.parse('MATCHSTATE:1:999::|TdQd'),
|
197
|
+
action: PokerAction.new('f')
|
198
|
+
}
|
199
|
+
),
|
200
|
+
HandData::Turn.new(
|
201
|
+
[
|
202
|
+
MatchState.parse('MATCHSTATE:1:999:f:|TdQd'),
|
203
|
+
MatchState.parse('MATCHSTATE:0:999:f:Jc8d|')
|
204
|
+
],
|
205
|
+
nil
|
206
|
+
)
|
207
|
+
]
|
208
|
+
},
|
209
|
+
three_player_limit: {
|
210
|
+
action_messages: [
|
211
|
+
"# name/game/hands/seed 3p.limit.h1000.r0 holdem.limit.3p.game 1000 0\n",
|
212
|
+
"TO 1 at 1341696046.871086 MATCHSTATE:0:999:ccc/ccc/rrcc/rrrfr:QsAs||/4d6d2d/5d/2c\n",
|
213
|
+
"TO 2 at 1341696046.871128 MATCHSTATE:1:999:ccc/ccc/rrcc/rrrfr:|3s8h|/4d6d2d/5d/2c\n",
|
214
|
+
"TO 3 at 1341696046.871175 MATCHSTATE:2:999:ccc/ccc/rrcc/rrrfr:||Qd3c/4d6d2d/5d/2c\n",
|
215
|
+
"FROM 3 at 1341696046.871201 MATCHSTATE:2:999:ccc/ccc/rrcc/rrrfr:||Qd3c/4d6d2d/5d/2c:c\n",
|
216
|
+
"TO 1 at 1341696046.871245 MATCHSTATE:0:999:ccc/ccc/rrcc/rrrfrc:QsAs|3s8h|Qd3c/4d6d2d/5d/2c\n",
|
217
|
+
"TO 2 at 1341696046.871267 MATCHSTATE:1:999:ccc/ccc/rrcc/rrrfrc:|3s8h|Qd3c/4d6d2d/5d/2c\n",
|
218
|
+
"TO 3 at 1341696046.871313 MATCHSTATE:2:999:ccc/ccc/rrcc/rrrfrc:|3s8h|Qd3c/4d6d2d/5d/2c\n",
|
219
|
+
"FINISHED at 1341696046.871175\n",
|
220
|
+
"SCORE:-4330|625|3705:p1|p2|p3"
|
221
|
+
],
|
222
|
+
result_message: [
|
223
|
+
"# name/game/hands/seed 3p.limit.h1000.r0 holdem.limit.3p.game 1000 0\n",
|
224
|
+
"STATE:999:ccc/rrcrcrcc/rcrrcc/crcrcrcrfc:Kd2d|6c2s|8hTh/2c4h9s/Ad/As:360|-190|-170:p1|p2|p3\n"
|
225
|
+
],
|
226
|
+
chip_distribution: [360, -190, -170],
|
227
|
+
player_names: ['p1', 'p2', 'p3'],
|
228
|
+
turn_data: [
|
229
|
+
HandData::Turn.new(
|
230
|
+
[
|
231
|
+
MatchState.parse('MATCHSTATE:0:999:ccc/ccc/rrcc/rrrfr:QsAs||/4d6d2d/5d/2c'),
|
232
|
+
MatchState.parse('MATCHSTATE:1:999:ccc/ccc/rrcc/rrrfr:|3s8h|/4d6d2d/5d/2c'),
|
233
|
+
MatchState.parse('MATCHSTATE:2:999:ccc/ccc/rrcc/rrrfr:||Qd3c/4d6d2d/5d/2c')
|
234
|
+
],
|
235
|
+
{
|
236
|
+
seat: 2,
|
237
|
+
state: MatchState.parse('MATCHSTATE:2:999:ccc/ccc/rrcc/rrrfr:||Qd3c/4d6d2d/5d/2c'),
|
238
|
+
action: PokerAction.new('c')
|
239
|
+
}
|
240
|
+
),
|
241
|
+
HandData::Turn.new(
|
242
|
+
[
|
243
|
+
MatchState.parse('MATCHSTATE:0:999:ccc/ccc/rrcc/rrrfrc:QsAs|3s8h|Qd3c/4d6d2d/5d/2c'),
|
244
|
+
MatchState.parse('MATCHSTATE:1:999:ccc/ccc/rrcc/rrrfrc:|3s8h|Qd3c/4d6d2d/5d/2c'),
|
245
|
+
MatchState.parse('MATCHSTATE:2:999:ccc/ccc/rrcc/rrrfrc:|3s8h|Qd3c/4d6d2d/5d/2c')
|
246
|
+
],
|
247
|
+
nil
|
248
|
+
)
|
249
|
+
]
|
250
|
+
},
|
251
|
+
three_player_nolimit: {
|
252
|
+
action_messages: [
|
253
|
+
"# name/game/hands/seed 3p.nolimit.h1000.r0 holdem.nolimit.3p.game 1000 0\n",
|
254
|
+
"TO 1 at 1341715420.129997 MATCHSTATE:0:999:ccr12926r20000c:QsAs||\n",
|
255
|
+
"TO 2 at 1341715420.130034 MATCHSTATE:1:999:ccr12926r20000c:|3s8h|\n",
|
256
|
+
"TO 3 at 1341715420.130070 MATCHSTATE:2:999:ccr12926r20000c:||Qd3c\n",
|
257
|
+
"FROM 2 at 1341715420.130093 MATCHSTATE:1:999:ccr12926r20000c:|3s8h|:c\n",
|
258
|
+
"TO 1 at 1341715420.130156 MATCHSTATE:0:999:ccr12926r20000cc///:QsAs|3s8h|Qd3c/4d6d2d/5d/2c\n",
|
259
|
+
"TO 2 at 1341715420.130191 MATCHSTATE:1:999:ccr12926r20000cc///:QsAs|3s8h|Qd3c/4d6d2d/5d/2c\n",
|
260
|
+
"TO 3 at 1341715420.130225 MATCHSTATE:2:999:ccr12926r20000cc///:QsAs|3s8h|Qd3c/4d6d2d/5d/2c\n",
|
261
|
+
"FINISHED at 1341715420.130034\n",
|
262
|
+
"SCORE:684452|552584.5|-1237036.5:p1|p2|p3"
|
263
|
+
],
|
264
|
+
result_message: [
|
265
|
+
"# name/game/hands/seed 3p.nolimit.h1000.r0 holdem.nolimit.3p.game 1000 0\n",
|
266
|
+
"STATE:999:ccc/ccc/r4881cr14955cr20000cc/:Kd2d|6c2s|8hTh/2c4h9s/Ad/As:40000|-20000|-20000:p1|p2|p3\n",
|
267
|
+
],
|
268
|
+
chip_distribution: [40000, -20000, -20000],
|
269
|
+
player_names: ['p1', 'p2', 'p3'],
|
270
|
+
turn_data: [
|
271
|
+
HandData::Turn.new(
|
272
|
+
[
|
273
|
+
MatchState.parse('MATCHSTATE:0:999:ccr12926r20000c:QsAs||'),
|
274
|
+
MatchState.parse('MATCHSTATE:1:999:ccr12926r20000c:|3s8h|'),
|
275
|
+
MatchState.parse('MATCHSTATE:2:999:ccr12926r20000c:||Qd3c')
|
276
|
+
],
|
277
|
+
{
|
278
|
+
seat: 1,
|
279
|
+
state: MatchState.parse('MATCHSTATE:1:999:ccr12926r20000c:|3s8h|'),
|
280
|
+
action: PokerAction.new('c')
|
281
|
+
}
|
282
|
+
),
|
283
|
+
HandData::Turn.new(
|
284
|
+
[
|
285
|
+
MatchState.parse('MATCHSTATE:0:999:ccr12926r20000cc///:QsAs|3s8h|Qd3c/4d6d2d/5d/2c'),
|
286
|
+
MatchState.parse('MATCHSTATE:1:999:ccr12926r20000cc///:QsAs|3s8h|Qd3c/4d6d2d/5d/2c'),
|
287
|
+
MatchState.parse('MATCHSTATE:2:999:ccr12926r20000cc///:QsAs|3s8h|Qd3c/4d6d2d/5d/2c')
|
288
|
+
],
|
289
|
+
nil
|
290
|
+
)
|
291
|
+
]
|
292
|
+
}
|
293
|
+
}
|
294
|
+
end
|
295
|
+
end
|
@@ -0,0 +1,231 @@
|
|
1
|
+
|
2
|
+
# Spec helper (must include first to track code coverage with SimpleCov)
|
3
|
+
require File.expand_path('../support/spec_helper', __FILE__)
|
4
|
+
|
5
|
+
require 'mocha'
|
6
|
+
|
7
|
+
require 'acpc_dealer'
|
8
|
+
|
9
|
+
require_relative '../lib/acpc_dealer_data/hand_results'
|
10
|
+
require_relative '../lib/acpc_dealer_data/match_definition'
|
11
|
+
|
12
|
+
describe HandResults do
|
13
|
+
before do
|
14
|
+
@patient = nil
|
15
|
+
@data = nil
|
16
|
+
@final_score = nil
|
17
|
+
@player_names = nil
|
18
|
+
@match_def = nil
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '::parse_state' do
|
22
|
+
it 'properly parses a ACPC log "STATE. . ." line' do
|
23
|
+
[
|
24
|
+
"STATE:0:rc/rrrrc/rc/crrrc:5d5c|9hQd/8dAs8s/4h/6d:28|-28:p1|p2\n" =>
|
25
|
+
{p1: 28, p2: -28},
|
26
|
+
"STATE:9:cc/cc/r165c/cc:4cKh|Kd7d/Ah9h9c/6s/Ks:0|0:p1|p2\n" =>
|
27
|
+
{p1: 0, p2: 0},
|
28
|
+
"STATE:18:rfrrc/cc/rrc/rrrrc:5d5c|9hQd|8dAs/8s4h6d/5s/Js:-5|-160|165:p1|p2|p3\n" =>
|
29
|
+
{p1: -5, p2: -160, p3: 165},
|
30
|
+
"STATE:1:cr13057cr20000cc///:Ks6h|Qs5d|Tc4d/Ah3dTd/8c/Qd:-20000|40000|-20000:p2|p3|p1\n" =>
|
31
|
+
{p1: -20000, p2: -20000, p3: 40000}
|
32
|
+
].each do |state_to_player_results|
|
33
|
+
state_to_player_results.each do |state_string, expected_values|
|
34
|
+
HandResults.parse_state(state_string).must_equal expected_values
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
it 'returns nil if asked to parse an improperly formatted string' do
|
39
|
+
HandResults.parse_state("improperly formatted string").must_be_nil
|
40
|
+
end
|
41
|
+
end
|
42
|
+
describe '::parse_score' do
|
43
|
+
it 'properly parses a ACPC log "SCORE. . ." line' do
|
44
|
+
[
|
45
|
+
"SCORE:100|-100:p1|p2\n" => {p1: 100, p2: -100},
|
46
|
+
'SCORE:19835|621.5|-20455.5:p1|p2|p3' => {p1: 19835, p2: 621.5, p3: -20455.5}
|
47
|
+
].each do |score_to_player_results|
|
48
|
+
score_to_player_results.each do |score_string, expected_values|
|
49
|
+
HandResults.parse_score(score_string).must_equal expected_values
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
it 'returns nil if asked to parse an improperly formatted string' do
|
54
|
+
HandResults.parse_score("improperly formatted string").must_be_nil
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
describe 'properly parses ACPC log statements' do
|
59
|
+
it 'from file' do
|
60
|
+
skip "Not sure how to test this easily when GameDefinition needs to open a file as well"
|
61
|
+
|
62
|
+
init_data do |log_statements|
|
63
|
+
file_name = 'file_name'
|
64
|
+
File.stubs(:open).with(file_name, 'r').yields(
|
65
|
+
log_statements
|
66
|
+
).returns(HandResults.parse(log_statements))
|
67
|
+
|
68
|
+
@patient = HandResults.parse_file file_name
|
69
|
+
|
70
|
+
check_patient
|
71
|
+
end
|
72
|
+
end
|
73
|
+
it 'from array' do
|
74
|
+
init_data do |log_statements|
|
75
|
+
@patient = HandResults.parse(
|
76
|
+
log_statements,
|
77
|
+
@player_names,
|
78
|
+
AcpcDealer::DEALER_DIRECTORY
|
79
|
+
)
|
80
|
+
|
81
|
+
check_patient
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def check_patient
|
87
|
+
@patient.data.must_equal @data
|
88
|
+
@patient.final_score.must_equal @final_score
|
89
|
+
@patient.match_def.must_equal @match_def
|
90
|
+
end
|
91
|
+
|
92
|
+
def init_data
|
93
|
+
all_data.each do |game, data_hash|
|
94
|
+
@final_score = data_hash[:final_score]
|
95
|
+
@data = data_hash[:data]
|
96
|
+
@player_names = data_hash[:player_names]
|
97
|
+
@match_def = MatchDefinition.parse(
|
98
|
+
data_hash[:log_statements].first,
|
99
|
+
@player_names,
|
100
|
+
AcpcDealer::DEALER_DIRECTORY
|
101
|
+
)
|
102
|
+
|
103
|
+
yield data_hash[:log_statements]
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def all_data
|
108
|
+
{
|
109
|
+
two_player_limit: {
|
110
|
+
log_statements: [
|
111
|
+
"# name/game/hands/seed 2p.limit.h1000.r0 holdem.limit.2p.reverse_blinds.game 1000 0\n",
|
112
|
+
"STATE:0:crrrc/rrc/rf:3s5d|Td2s/4d5c4s/Kd:60|-60:p1|p2\n",
|
113
|
+
"STATE:1:rc/crrrrc/rrc/rc:7d5s|Kh9c/As3hTs/Jh/Js:-120|120:p2|p1\n",
|
114
|
+
"STATE:2:cc/cc/rc/rc:Kh6h|As2h/Qd2c2d/7d/3d:-50|50:p1|p2\n",
|
115
|
+
"STATE:3:cc/rrrc/rc/rc:8c7d|QcKc/Ac6hTd/9h/3d:80|-80:p2|p1\n",
|
116
|
+
"STATE:4:rf:6s9d|4dQd:-10|10:p1|p2\n",
|
117
|
+
"STATE:5:cc/crc/cc/cc:6c2d|9cKs/4dKc7d/Td/Ah:-20|20:p2|p1\n",
|
118
|
+
"STATE:6:rrrc/rc/cc/rc:9h7h|3d8s/JcAc5c/Ah/Ks:70|-70:p1|p2\n",
|
119
|
+
"STATE:7:rrrf:5s9c|8dJh:-30|30:p2|p1\n",
|
120
|
+
"STATE:8:rrrc/cc/rc/rrc:Kc6h|Qc3s/QhAh8d/Th/9d:-100|100:p1|p2\n",
|
121
|
+
"STATE:9:crc/cc/cc/rc:Jc8d|TdQd/As6d6h/7h/4s:-40|40:p2|p1\n",
|
122
|
+
'SCORE:100|-100:p1|p2'
|
123
|
+
],
|
124
|
+
data: [
|
125
|
+
{p1: 60, p2: -60},
|
126
|
+
{p1: 120, p2: -120},
|
127
|
+
{p1: -50, p2: 50},
|
128
|
+
{p1: -80, p2: 80},
|
129
|
+
{p1: -10, p2: 10},
|
130
|
+
{p1: 20, p2: -20},
|
131
|
+
{p1: 70, p2: -70},
|
132
|
+
{p1: 30, p2: -30},
|
133
|
+
{p1: -100, p2: 100},
|
134
|
+
{p1: 40, p2: -40}
|
135
|
+
],
|
136
|
+
final_score: {p1: 100, p2: -100},
|
137
|
+
player_names: ['p1', 'p2']
|
138
|
+
},
|
139
|
+
two_player_nolimit: {
|
140
|
+
log_statements: [
|
141
|
+
"# name/game/hands/seed 2p.nolimit.h1000.r0 holdem.nolimit.2p.reverse_blinds.game 1000 0\n",
|
142
|
+
"STATE:0:r5924c/r17356c/cc/r19718c:3s5d|Td2s/4d5c4s/Kd/2c:19718|-19718:p1|p2\n",
|
143
|
+
"STATE:1:cc/r7485r16652c/r17998r19429r20000c/:7d5s|Kh9c/As3hTs/Jh/Js:-20000|20000:p2|p1\n",
|
144
|
+
"STATE:2:r18810c/r19264r19774c/cr19995r20000c/:Kh6h|As2h/Qd2c2d/7d/3d:-20000|20000:p1|p2\n",
|
145
|
+
"STATE:3:cr281c/r18446r20000c//:8c7d|QcKc/Ac6hTd/9h/3d:20000|-20000:p2|p1\n",
|
146
|
+
"STATE:4:r13583r20000f:6s9d|4dQd:13583|-13583:p1|p2\n",
|
147
|
+
"STATE:5:cc/r15416f:6c2d|9cKs/4dKc7d:100|-100:p2|p1\n",
|
148
|
+
"STATE:6:r15542r20000c///:9h7h|3d8s/JcAc5c/Ah/Ks:20000|-20000:p1|p2\n",
|
149
|
+
"STATE:7:r1147c/cc/cr5404f:5s9c|8dJh/TdQc9d/Jd:-1147|1147:p2|p1\n",
|
150
|
+
"STATE:8:cc/r5841r19996r20000c//:Kc6h|Qc3s/QhAh8d/Th/9d:-20000|20000:p1|p2\n",
|
151
|
+
"STATE:9:f:Jc8d|TdQd:50|-50:p2|p1\n",
|
152
|
+
'SCORE:14298|-14298:p1|p2'
|
153
|
+
],
|
154
|
+
data: [
|
155
|
+
{p1: 19718, p2: -19718},
|
156
|
+
{p1: 20000, p2: -20000},
|
157
|
+
{p1: -20000, p2: 20000},
|
158
|
+
{p1: -20000, p2: 20000},
|
159
|
+
{p1: 13583, p2: -13583},
|
160
|
+
{p1: -100, p2: 100},
|
161
|
+
{p1: 20000, p2: -20000},
|
162
|
+
{p1: 1147, p2: -1147},
|
163
|
+
{p1: -20000, p2: 20000},
|
164
|
+
{p1: -50, p2: 50}
|
165
|
+
],
|
166
|
+
final_score: {p1: 14298, p2: -14298},
|
167
|
+
player_names: ['p1', 'p2']
|
168
|
+
},
|
169
|
+
three_player_limit: {
|
170
|
+
log_statements: [
|
171
|
+
"# name/game/hands/seed 3p.limit.h1000.r0 holdem.limit.3p.game 1000 0\n",
|
172
|
+
"STATE:0:ccc/rrcrcrcc/rcrrcc/crcrcrcrfc:Kd2d|6c2s|8hTh/2c4h9s/Ad/As:360|-190|-170:p1|p2|p3\n",
|
173
|
+
"STATE:1:rrcrcc/rrrcf/rrrrc/cc:Td7s|4c5s|Qc4s/5dAd7c/6c/2c:210|-60|-150:p2|p3|p1\n",
|
174
|
+
"STATE:2:fcc/crc/crrc/rrc:Jh9d|8hAh|As6c/3dKc3c/2d/Kh:-100|100|0:p3|p1|p2\n",
|
175
|
+
"STATE:3:rcrcrcf/rc/cc/rc:Qd2h|5c4d|6s2d/As8s6d/7d/2c:-70|100|-30:p1|p2|p3\n",
|
176
|
+
"STATE:4:rrcc/rrrrcf/rrc/rc:8d4c|6sQd|Ts2s/2d9hTh/8c/5h:190|-130|-60:p2|p3|p1\n",
|
177
|
+
"STATE:5:rrrcc/crrfrrc/crc/cc:7cKh|3s2h|Js4h/KcQc2s/5h/4s:-40|-100|140:p3|p1|p2\n",
|
178
|
+
"STATE:6:rrcrcc/rrrcc/ccrrcrcrcc/crrrrfc:QhQd|3cQc|2cTh/Jc8hTs/9c/3s:95|95|-190:p1|p2|p3\n",
|
179
|
+
"STATE:7:crrcrcc/crrfrc/cc/rrc:Qd2s|KdTs|6dQh/6h6sTc/3h/Jd:-40|-110|150:p2|p3|p1\n",
|
180
|
+
"STATE:8:frc/cc/rc/rrc:6hKc|6cAd|6d2c/QdTd9h/7h/Jc:80|-80|0:p3|p1|p2\n",
|
181
|
+
"STATE:9:ccc/ccc/rrcc/rrrfrc:QsAs|3s8h|Qd3c/4d6d2d/5d/2c:-70|-130|200:p1|p2|p3\n",
|
182
|
+
'SCORE:105|375|-550:p1|p2|p3'
|
183
|
+
],
|
184
|
+
data: [
|
185
|
+
{p1: 360, p2: -190, p3: -170},
|
186
|
+
{p1: -150, p2: 210, p3: -60},
|
187
|
+
{p1: 100, p2: 0, p3: -100},
|
188
|
+
{p1: -70, p2: 100, p3: -30},
|
189
|
+
{p1: -60, p2: 190, p3: -130},
|
190
|
+
{p1: -100, p2: 140, p3: -40},
|
191
|
+
{p1: 95, p2: 95, p3: -190},
|
192
|
+
{p1: 150, p2: -40, p3: -110},
|
193
|
+
{p1: -80, p2: 0, p3: 80},
|
194
|
+
{p1: -70, p2: -130, p3: 200}
|
195
|
+
],
|
196
|
+
final_score: {p1: 105, p2: 375, p3: -550},
|
197
|
+
player_names: ['p1', 'p2', 'p3']
|
198
|
+
},
|
199
|
+
three_player_nolimit: {
|
200
|
+
log_statements: [
|
201
|
+
"# name/game/hands/seed 3p.nolimit.h1000.r0 holdem.nolimit.3p.game 1000 0\n",
|
202
|
+
"STATE:0:ccc/ccc/r4881cr14955cr20000cc/:Kd2d|6c2s|8hTh/2c4h9s/Ad/As:40000|-20000|-20000:p1|p2|p3\n",
|
203
|
+
"STATE:1:ccc/cr7400r17645r20000cc//:Td7s|4c5s|Qc4s/5dAd7c/6c/2c:40000|-20000|-20000:p2|p3|p1\n",
|
204
|
+
"STATE:2:r7187r19832cc/cr19953fc/cr20000c/:Jh9d|8hAh|As6c/3dKc3c/2d/Kh:-20000|39832|-19832:p3|p1|p2\n",
|
205
|
+
"STATE:3:r3610cr8213r19531r20000cc///:Qd2h|5c4d|6s2d/As8s6d/7d/2c:-20000|40000|-20000:p1|p2|p3\n",
|
206
|
+
"STATE:4:fcc/r1348c/r8244r18929r20000c/:8d4c|6sQd|Ts2s/2d9hTh/8c/5h:20000|-20000|0:p2|p3|p1\n",
|
207
|
+
"STATE:5:r15492cc/ccr17275cc/r19597cc/r19947cf:7cKh|3s2h|Js4h/KcQc2s/5h/4s:39544|-19947|-19597:p3|p1|p2\n",
|
208
|
+
"STATE:6:r10322fc/r10577r18645r20000c//:QhQd|3cQc|2cTh/Jc8hTs/9c/3s:-50|20050|-20000:p1|p2|p3\n",
|
209
|
+
"STATE:7:ccr8533r17298r20000cc///:Qd2s|KdTs|6dQh/6h6sTc/3h/Jd:-20000|-20000|40000:p2|p3|p1\n",
|
210
|
+
"STATE:8:cr18231r20000cc///:6hKc|6cAd|6d2c/QdTd9h/7h/Jc:40000|-20000|-20000:p3|p1|p2\n",
|
211
|
+
"STATE:9:ccr12926r20000cc///:QsAs|3s8h|Qd3c/4d6d2d/5d/2c:-20000|-20000|40000:p1|p2|p3\n",
|
212
|
+
'SCORE:19835|621|-20456:p1|p2|p3'
|
213
|
+
],
|
214
|
+
data: [
|
215
|
+
{p1: 40000, p2: -20000, p3: -20000},
|
216
|
+
{p1: -20000, p2: 40000, p3: -20000},
|
217
|
+
{p1: 39832, p2: -19832, p3: -20000},
|
218
|
+
{p1: -20000, p2: 40000, p3: -20000},
|
219
|
+
{p1: 0, p2: 20000, p3: -20000},
|
220
|
+
{p1: -19947, p2: -19597, p3: 39544},
|
221
|
+
{p1: -50, p2: 20050, p3: -20000},
|
222
|
+
{p1: 40000, p2: -20000, p3: -20000},
|
223
|
+
{p1: -20000, p2: -20000, p3: 40000},
|
224
|
+
{p1: -20000, p2: -20000, p3: 40000}
|
225
|
+
],
|
226
|
+
final_score: {p1: 19835, p2: 621, p3: -20456},
|
227
|
+
player_names: ['p1', 'p2', 'p3']
|
228
|
+
}
|
229
|
+
}
|
230
|
+
end
|
231
|
+
end
|