acpc_dealer_data 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
@@ -142,8 +142,8 @@ class PokerMatchData
|
|
142
142
|
|
143
143
|
@players.each_with_index do |player, seat|
|
144
144
|
player.start_new_hand!(
|
145
|
-
@match_def.game_def.blinds[
|
146
|
-
@match_def.game_def.chip_stacks[
|
145
|
+
@match_def.game_def.blinds[seat],
|
146
|
+
@match_def.game_def.chip_stacks[seat],
|
147
147
|
current_hand.data.first.state_messages[seat].users_hole_cards
|
148
148
|
)
|
149
149
|
end
|
@@ -165,8 +165,8 @@ class PokerMatchData
|
|
165
165
|
last_match_state = current_hand.last_match_state(seat)
|
166
166
|
match_state = current_hand.current_match_state(seat)
|
167
167
|
|
168
|
-
if current_hand.
|
169
|
-
player.take_action!(current_hand.
|
168
|
+
if current_hand.last_action && player.seat == current_hand.last_action.seat
|
169
|
+
player.take_action!(current_hand.last_action.action)
|
170
170
|
end
|
171
171
|
|
172
172
|
if !match_state.first_state_of_first_round? && match_state.round > last_match_state.round
|
@@ -175,7 +175,7 @@ class PokerMatchData
|
|
175
175
|
|
176
176
|
if current_hand.final_turn?
|
177
177
|
player.take_winnings!(
|
178
|
-
current_hand.chip_distribution[seat] + @match_def.game_def.blinds[
|
178
|
+
current_hand.chip_distribution[seat] + @match_def.game_def.blinds[seat]
|
179
179
|
)
|
180
180
|
end
|
181
181
|
end
|
@@ -186,6 +186,30 @@ class PokerMatchData
|
|
186
186
|
self
|
187
187
|
end
|
188
188
|
|
189
|
+
def player_acting_sequence
|
190
|
+
return nil unless @hand_number
|
191
|
+
|
192
|
+
sequence = [[]]
|
193
|
+
|
194
|
+
return sequence if current_hand.turn_number < 1
|
195
|
+
|
196
|
+
turns_taken = current_hand.data[0..current_hand.turn_number-1]
|
197
|
+
turns_taken.each_with_index do |turn, turn_index|
|
198
|
+
next unless turn.action_message
|
199
|
+
|
200
|
+
sequence[turn.action_message.state.round] << turn.action_message.seat
|
201
|
+
|
202
|
+
if (
|
203
|
+
new_round?(sequence.length - 1 , turn_index) ||
|
204
|
+
players_all_in?(sequence.length - 1, turn_index)
|
205
|
+
)
|
206
|
+
sequence << []
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
sequence
|
211
|
+
end
|
212
|
+
|
189
213
|
def current_hand
|
190
214
|
if @hand_number then @data[@hand_number] else nil end
|
191
215
|
end
|
@@ -233,4 +257,21 @@ class PokerMatchData
|
|
233
257
|
|
234
258
|
self
|
235
259
|
end
|
260
|
+
|
261
|
+
private
|
262
|
+
|
263
|
+
def players_all_in?(current_round, turn_index)
|
264
|
+
current_hand.data.length == turn_index + 2 &&
|
265
|
+
current_round < (@match_def.game_def.number_of_rounds - 1) &&
|
266
|
+
turn.action_message &&
|
267
|
+
(turns_taken[0..turn_index].count do |t|
|
268
|
+
t.action_message.action.to_sym == :fold
|
269
|
+
end) != @players.length - 1
|
270
|
+
end
|
271
|
+
|
272
|
+
def new_round?(current_round, turn_index)
|
273
|
+
current_hand.data.length > turn_index + 1 &&
|
274
|
+
current_hand.data[turn_index + 1].action_message &&
|
275
|
+
current_hand.data[turn_index + 1].action_message.state.round > current_round
|
276
|
+
end
|
236
277
|
end
|
@@ -100,9 +100,13 @@ describe PokerMatchData do
|
|
100
100
|
|
101
101
|
@hand_number = 0
|
102
102
|
@patient.for_every_hand! do
|
103
|
+
@turn_number = 0
|
104
|
+
|
103
105
|
@final_hand = @hand_number >= @hand_data_list.length - 1
|
104
106
|
@patient.for_every_turn! do
|
105
107
|
check_patient
|
108
|
+
|
109
|
+
@turn_number += 1
|
106
110
|
end
|
107
111
|
|
108
112
|
@hand_number += 1
|
@@ -126,9 +130,13 @@ describe PokerMatchData do
|
|
126
130
|
|
127
131
|
@hand_number = 0
|
128
132
|
@patient.for_every_hand! do
|
133
|
+
@turn_number = 0
|
134
|
+
|
129
135
|
@final_hand = @hand_number >= @hand_data_list.length - 1
|
130
136
|
@patient.for_every_turn! do
|
131
137
|
check_patient
|
138
|
+
|
139
|
+
@turn_number += 1
|
132
140
|
end
|
133
141
|
|
134
142
|
@hand_number += 1
|
@@ -144,6 +152,7 @@ describe PokerMatchData do
|
|
144
152
|
@patient.hand_number.must_equal @hand_number
|
145
153
|
@patient.current_hand.must_equal @hand_data_list[@hand_number]
|
146
154
|
@patient.final_hand?.must_equal @final_hand
|
155
|
+
@patient.player_acting_sequence.must_equal @player_acting_sequences[@hand_number] if @turn_number + 1 == @hand_data_list[@hand_number].data.length
|
147
156
|
end
|
148
157
|
|
149
158
|
def init_data(num_hands=nil)
|
@@ -177,6 +186,8 @@ describe PokerMatchData do
|
|
177
186
|
hand_result
|
178
187
|
)
|
179
188
|
end
|
189
|
+
|
190
|
+
@player_acting_sequences = data_hash[:player_acting_sequences]
|
180
191
|
|
181
192
|
yield data_hash[:action_messages], data_hash[:result_messages]
|
182
193
|
end
|
@@ -267,7 +278,8 @@ describe PokerMatchData do
|
|
267
278
|
hand_start_line_indices: [6, 35],
|
268
279
|
match_def_line_index: 0,
|
269
280
|
player_names: ['p1', 'p2'],
|
270
|
-
chip_distribution: [110, -110]
|
281
|
+
chip_distribution: [110, -110],
|
282
|
+
player_acting_sequences: [[[1, 0], [0, 1, 0], [0, 1], [0, 1]], [[0, 1, 0], [1, 0], [1, 0, 1], [1, 0]]]
|
271
283
|
}
|
272
284
|
}
|
273
285
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acpc_dealer_data
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: acpc_dealer
|
@@ -164,7 +164,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
164
164
|
version: '0'
|
165
165
|
segments:
|
166
166
|
- 0
|
167
|
-
hash: -
|
167
|
+
hash: -4118394275309926132
|
168
168
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
169
169
|
none: false
|
170
170
|
requirements:
|
@@ -173,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
173
173
|
version: '0'
|
174
174
|
segments:
|
175
175
|
- 0
|
176
|
-
hash: -
|
176
|
+
hash: -4118394275309926132
|
177
177
|
requirements: []
|
178
178
|
rubyforge_project:
|
179
179
|
rubygems_version: 1.8.24
|