acpc_poker_player_proxy 0.0.2 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +9 -29
- data/acpc_poker_player_proxy.gemspec +12 -11
- data/lib/acpc_poker_player_proxy/player_proxy.rb +8 -6
- data/lib/acpc_poker_player_proxy/version.rb +1 -1
- data/spec/coverage/index.html +1 -1
- data/spec/player_proxy_spec.rb +227 -0
- data/spec/support/spec_helper.rb +25 -8
- metadata +55 -50
- data/spec/player_proxy_limit_spec.rb +0 -367
- data/spec/player_proxy_nolimit_spec.rb +0 -547
- data/spec/support/dealer_data.rb +0 -140058
- data/spec/support/dealer_data.two_player_limit.rb +0 -13593
- data/spec/support/rearrange_dealer_data.rb +0 -54
- data/tasks.rb +0 -10
@@ -1,367 +0,0 @@
|
|
1
|
-
|
2
|
-
require File.expand_path('../support/spec_helper', __FILE__)
|
3
|
-
|
4
|
-
require 'acpc_poker_types/player'
|
5
|
-
require 'acpc_poker_basic_proxy/basic_proxy'
|
6
|
-
require 'acpc_poker_types/game_definition'
|
7
|
-
|
8
|
-
require File.expand_path('../support/dealer_data', __FILE__)
|
9
|
-
|
10
|
-
require File.expand_path('../../lib/acpc_poker_player_proxy/player_proxy', __FILE__)
|
11
|
-
|
12
|
-
describe PlayerProxy do
|
13
|
-
include DealerData
|
14
|
-
|
15
|
-
# @todo integrate this into the data where its collected
|
16
|
-
GAME_DEFS = {
|
17
|
-
limit: {
|
18
|
-
stack_size: 400, small_bets: [2, 2, 4, 4],
|
19
|
-
first_player_positions: [1, 0, 0, 0],
|
20
|
-
blinds: [2, 1],
|
21
|
-
number_of_hands: 100
|
22
|
-
},
|
23
|
-
nolimit: {
|
24
|
-
stack_size: 20000, small_bets: [100, 100, 100, 100],
|
25
|
-
first_player_positions: [1, 0, 0, 0],
|
26
|
-
blinds: [100, 50],
|
27
|
-
number_of_hands: 100
|
28
|
-
}
|
29
|
-
}
|
30
|
-
|
31
|
-
PORT_NUMBER = 9001
|
32
|
-
HOST_NAME = 'localhost'
|
33
|
-
MILLISECOND_RESPONSE_TIMEOUT = 0
|
34
|
-
DEALER_INFO = AcpcDealerInformation.new HOST_NAME, PORT_NUMBER, MILLISECOND_RESPONSE_TIMEOUT
|
35
|
-
|
36
|
-
describe '#update!' do
|
37
|
-
describe "keeps track of state for a sequence of match states and actions in Doyle's game" do
|
38
|
-
it 'in limit' do
|
39
|
-
# @todo Move into data retrieval method
|
40
|
-
DealerData::DATA.each do |num_players, data_by_num_players|
|
41
|
-
@number_of_players = num_players
|
42
|
-
((0..(num_players-1)).map{ |i| (i+1).to_s }).each do |seat|
|
43
|
-
data_by_num_players.each do |type, data_by_type|
|
44
|
-
next unless type == :limit
|
45
|
-
|
46
|
-
check_turns_of_given_type! seat, type, data_by_type
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def check_turns_of_given_type!(seat, type, data_by_type)
|
55
|
-
@hand_num = 0
|
56
|
-
@users_seat = seat.to_i - 1
|
57
|
-
|
58
|
-
turns = data_by_type[:actions]
|
59
|
-
|
60
|
-
init_before_first_turn_data! @number_of_players, type
|
61
|
-
|
62
|
-
init_game_def! type, @players
|
63
|
-
GameDefinition.stubs(:new).with(@game_def).returns(@game_def)
|
64
|
-
|
65
|
-
@basic_proxy = mock 'BasicProxy'
|
66
|
-
BasicProxy.stubs(:new).with(DEALER_INFO).returns(@basic_proxy)
|
67
|
-
|
68
|
-
Player.stubs(:create_players).with(
|
69
|
-
@players.map{|p| p.name}, @game_def
|
70
|
-
).returns(@players)
|
71
|
-
|
72
|
-
@expected_players_at_the_table = PlayersAtTheTable.seat_players(
|
73
|
-
@game_def, @players.map{|p| p.name}, @users_seat, GAME_DEFS[type][:number_of_hands]
|
74
|
-
)
|
75
|
-
|
76
|
-
players_for_patient = create_players type, @number_of_players
|
77
|
-
|
78
|
-
Player.stubs(:create_players).with(
|
79
|
-
players_for_patient.map{|p| p.name}, @game_def
|
80
|
-
).returns(players_for_patient)
|
81
|
-
|
82
|
-
i = 0
|
83
|
-
@patient = PlayerProxy.new(
|
84
|
-
DEALER_INFO,
|
85
|
-
@users_seat,
|
86
|
-
@game_def,
|
87
|
-
(@players.map{ |player| player.name }).join(' '),
|
88
|
-
GAME_DEFS[type][:number_of_hands]
|
89
|
-
) do |players_at_the_table|
|
90
|
-
check_players_at_the_table players_at_the_table
|
91
|
-
|
92
|
-
unless players_at_the_table.users_turn_to_act? || players_at_the_table.match_ended?
|
93
|
-
i = check_turn! i, turns, seat, type, data_by_type
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
# @todo match ended won't be restricted once data is separated better by game def
|
98
|
-
while (i < turns.length) && !@match_ended
|
99
|
-
i = check_turn! i, turns, seat, type, data_by_type
|
100
|
-
end
|
101
|
-
end
|
102
|
-
def check_turn!(i, turns, seat, type, data_by_type)
|
103
|
-
return i+1 if @match_ended
|
104
|
-
|
105
|
-
turn = turns[i]
|
106
|
-
next_turn = turns[i + 1]
|
107
|
-
from_player_message = turn[:from_players]
|
108
|
-
match_state = turn[:to_players][seat]
|
109
|
-
prev_round = if @last_match_state then @last_match_state.round else nil end
|
110
|
-
|
111
|
-
@last_hand = ((GAME_DEFS[type][:number_of_hands] - 1) == @hand_num)
|
112
|
-
|
113
|
-
@next_player_to_act = if index_of_next_player_to_act(next_turn) < 0
|
114
|
-
nil
|
115
|
-
else
|
116
|
-
@players[index_of_next_player_to_act(next_turn)]
|
117
|
-
end
|
118
|
-
@users_turn_to_act = if @next_player_to_act
|
119
|
-
@next_player_to_act.seat == @users_seat
|
120
|
-
else
|
121
|
-
false
|
122
|
-
end
|
123
|
-
|
124
|
-
@last_match_state = MatchState.parse match_state
|
125
|
-
|
126
|
-
@hole_card_hands = order_by_seat_from_dealer_relative @last_match_state.list_of_hole_card_hands,
|
127
|
-
@last_match_state.position_relative_to_dealer
|
128
|
-
|
129
|
-
if @last_match_state.first_state_of_first_round?
|
130
|
-
init_new_hand_data! type
|
131
|
-
else
|
132
|
-
init_new_turn_data! type, from_player_message, prev_round
|
133
|
-
end
|
134
|
-
|
135
|
-
if @last_match_state.round != prev_round || @last_match_state.first_state_of_first_round?
|
136
|
-
@player_acting_sequence << []
|
137
|
-
@betting_sequence << []
|
138
|
-
end
|
139
|
-
|
140
|
-
if !next_turn || MatchState.parse(next_turn[:to_players]['1']).first_state_of_first_round?
|
141
|
-
init_hand_result_data! data_by_type
|
142
|
-
end
|
143
|
-
|
144
|
-
@expected_players_at_the_table.update! @last_match_state
|
145
|
-
|
146
|
-
init_after_update_data! type
|
147
|
-
|
148
|
-
@basic_proxy.expects(:receive_match_state!).returns(@last_match_state)
|
149
|
-
|
150
|
-
return i+1 if from_player_message.empty?
|
151
|
-
|
152
|
-
seat_taking_action = from_player_message.keys.first
|
153
|
-
|
154
|
-
return i+1 unless seat_taking_action == seat
|
155
|
-
|
156
|
-
action = PokerAction.new from_player_message[seat_taking_action]
|
157
|
-
|
158
|
-
@basic_proxy.expects(:send_action).with(action)
|
159
|
-
|
160
|
-
i += 1
|
161
|
-
@patient.play!(action) do |players_at_the_table|
|
162
|
-
check_players_at_the_table players_at_the_table
|
163
|
-
|
164
|
-
i = check_turn! i, turns, seat, type, data_by_type
|
165
|
-
end
|
166
|
-
|
167
|
-
i
|
168
|
-
end
|
169
|
-
|
170
|
-
|
171
|
-
def init_after_update_data!(type)
|
172
|
-
@active_players = @players.select { |player| player.active? }
|
173
|
-
@non_folded_players = @players.select { |player| !player.folded? }
|
174
|
-
@opponents_cards_visible = @opponents.any? { |player| !player.hole_cards.empty? }
|
175
|
-
@reached_showdown = @opponents_cards_visible
|
176
|
-
@less_than_two_non_folded_players = @non_folded_players.length < 2
|
177
|
-
@hand_ended = @less_than_two_non_folded_players || @reached_showdown
|
178
|
-
@match_ended = @hand_ended && @last_hand
|
179
|
-
@player_with_dealer_button = nil
|
180
|
-
@players.each_index do |j|
|
181
|
-
if positions_relative_to_dealer[j] == @players.length - 1
|
182
|
-
@player_with_dealer_button = @players[j]
|
183
|
-
end
|
184
|
-
end
|
185
|
-
@player_blind_relation = @players.inject({}) do |hash, player|
|
186
|
-
hash[player] = GAME_DEFS[type][:blinds][positions_relative_to_dealer[player.seat]]
|
187
|
-
hash
|
188
|
-
end
|
189
|
-
end
|
190
|
-
def init_hand_result_data!(data_by_type)
|
191
|
-
result = data_by_type[:results][@hand_num]
|
192
|
-
@hand_num += 1
|
193
|
-
|
194
|
-
result.each do |player_name, final_balance|
|
195
|
-
# @todo This assumption isn't robust yet
|
196
|
-
player = @players.find { |p| p.name == player_name }
|
197
|
-
|
198
|
-
# @todo Only in Doyle's game
|
199
|
-
@chip_stacks[player.seat] =
|
200
|
-
@game_def.chip_stacks[positions_relative_to_dealer[player.seat]].to_i +
|
201
|
-
final_balance.to_i
|
202
|
-
|
203
|
-
# @todo Assumes Doyle's game in three player
|
204
|
-
if final_balance.to_i == 0
|
205
|
-
@chip_balances[player.seat] = @last_hands_balance[player.seat].to_i
|
206
|
-
@chip_contributions[player.seat] << -@chip_contributions[player.seat].sum
|
207
|
-
elsif final_balance.to_i > 0
|
208
|
-
@chip_balances[player.seat] = @last_hands_balance[player.seat].to_i + final_balance.to_i
|
209
|
-
@chip_contributions[player.seat] << -@chip_contributions.mapped_sum.sum
|
210
|
-
end
|
211
|
-
|
212
|
-
@last_hands_balance[player.seat] = @chip_balances[player.seat]
|
213
|
-
end
|
214
|
-
end
|
215
|
-
def init_new_turn_data!(type, from_player_message, prev_round)
|
216
|
-
@betting_sequence << [] if @betting_sequence.empty?
|
217
|
-
@player_acting_sequence << [] if @player_acting_sequence.empty?
|
218
|
-
|
219
|
-
seat_taking_action = from_player_message.keys.first
|
220
|
-
seat_of_last_player_to_act = seat_taking_action.to_i - 1
|
221
|
-
@player_who_acted_last = @players[seat_of_last_player_to_act]
|
222
|
-
|
223
|
-
@last_action = PokerAction.new(
|
224
|
-
from_player_message[seat_taking_action], {
|
225
|
-
amount_to_put_in_pot: @expected_players_at_the_table.cost_of_action(
|
226
|
-
@player_who_acted_last,
|
227
|
-
PokerAction.new(from_player_message[seat_taking_action]), (
|
228
|
-
@betting_sequence.length - 1
|
229
|
-
)
|
230
|
-
),
|
231
|
-
acting_player_sees_wager: (
|
232
|
-
@expected_players_at_the_table.amount_to_call(@player_who_acted_last) > 0 || (
|
233
|
-
GAME_DEFS[type][:blinds][positions_relative_to_dealer[seat_of_last_player_to_act]] > 0 && (
|
234
|
-
@player_who_acted_last.actions_taken_this_hand[0].length < 1
|
235
|
-
)
|
236
|
-
)
|
237
|
-
)
|
238
|
-
}
|
239
|
-
)
|
240
|
-
|
241
|
-
@chip_contributions[seat_of_last_player_to_act][-1] += @last_action.amount_to_put_in_pot.to_i
|
242
|
-
@chip_stacks[seat_of_last_player_to_act] -= @last_action.amount_to_put_in_pot
|
243
|
-
@chip_balances[seat_of_last_player_to_act] -= @last_action.amount_to_put_in_pot.to_i
|
244
|
-
|
245
|
-
@player_acting_sequence.last << seat_of_last_player_to_act
|
246
|
-
@player_acting_sequence_string += seat_of_last_player_to_act.to_s
|
247
|
-
@betting_sequence.last << @last_action
|
248
|
-
@betting_sequence_string += @last_action.to_acpc
|
249
|
-
|
250
|
-
if @last_match_state.round != prev_round
|
251
|
-
@player_acting_sequence_string += '/'
|
252
|
-
@betting_sequence_string += '/'
|
253
|
-
@chip_contributions.each do |contribution|
|
254
|
-
contribution << 0
|
255
|
-
end
|
256
|
-
end
|
257
|
-
end
|
258
|
-
def init_new_hand_data!(type)
|
259
|
-
@player_who_acted_last = nil
|
260
|
-
|
261
|
-
@player_acting_sequence = []
|
262
|
-
@player_acting_sequence_string = ''
|
263
|
-
|
264
|
-
@betting_sequence = []
|
265
|
-
@betting_sequence_string = ''
|
266
|
-
|
267
|
-
init_new_hand_chip_data! type
|
268
|
-
end
|
269
|
-
def init_new_hand_chip_data!(type)
|
270
|
-
# @todo Assumes Doyle's Game
|
271
|
-
@chip_stacks = @players.each_index.inject([]) { |stacks, j| stacks << GAME_DEFS[type][:stack_size] }
|
272
|
-
@chip_contributions = []
|
273
|
-
@chip_stacks.each_index do |j|
|
274
|
-
@chip_stacks[j] -= GAME_DEFS[type][:blinds][positions_relative_to_dealer[j]]
|
275
|
-
@chip_balances[j] -= GAME_DEFS[type][:blinds][positions_relative_to_dealer[j]].to_i
|
276
|
-
@chip_contributions << [GAME_DEFS[type][:blinds][positions_relative_to_dealer[j]].to_i]
|
277
|
-
end
|
278
|
-
end
|
279
|
-
def init_before_first_turn_data!(num_players, type)
|
280
|
-
@last_hands_balance = num_players.times.inject([]) { |balances, i| balances << 0 }
|
281
|
-
@players = create_players(type, num_players)
|
282
|
-
@chip_balances = @players.map { |player| player.chip_balance.to_i }
|
283
|
-
@chip_contributions = @players.map { |player| player.chip_contributions }
|
284
|
-
@user_player = @players[@users_seat]
|
285
|
-
@opponents = @players.select { |player| !player.eql?(@user_player) }
|
286
|
-
@hole_card_hands = @players.inject([]) { |hands, player| hands << player.hole_cards }
|
287
|
-
@opponents_cards_visible = false
|
288
|
-
@reached_showdown = @opponents_cards_visible
|
289
|
-
@less_than_two_non_folded_players = false
|
290
|
-
@hand_ended = @less_than_two_non_folded_players || @reached_showdown
|
291
|
-
@last_hand = false
|
292
|
-
@match_ended = @hand_ended && @last_hand
|
293
|
-
@active_players = @players
|
294
|
-
@non_folded_players = @players
|
295
|
-
@player_acting_sequence = [[]]
|
296
|
-
@player_acting_sequence_string = ''
|
297
|
-
@users_turn_to_act = false
|
298
|
-
@chip_stacks = @players.map { |player| player.chip_stack }
|
299
|
-
@betting_sequence = [[]]
|
300
|
-
@betting_sequence_string = ''
|
301
|
-
@player_who_acted_last = nil
|
302
|
-
@next_player_to_act = nil
|
303
|
-
@player_with_dealer_button = nil
|
304
|
-
@player_blind_relation = nil
|
305
|
-
end
|
306
|
-
def index_of_next_player_to_act(turn) turn[:from_players].keys.first.to_i - 1 end
|
307
|
-
def positions_relative_to_dealer
|
308
|
-
positions = []
|
309
|
-
@last_match_state.list_of_hole_card_hands.each_index do |pos_rel_dealer|
|
310
|
-
@hole_card_hands.each_index do |seat|
|
311
|
-
if @hole_card_hands[seat] == @last_match_state.list_of_hole_card_hands[pos_rel_dealer]
|
312
|
-
positions[seat] = pos_rel_dealer
|
313
|
-
end
|
314
|
-
end
|
315
|
-
@last_match_state.list_of_hole_card_hands
|
316
|
-
end
|
317
|
-
positions
|
318
|
-
end
|
319
|
-
def order_by_seat_from_dealer_relative(list_of_hole_card_hands,
|
320
|
-
users_pos_rel_to_dealer)
|
321
|
-
new_list = [].fill Hand.new, (0..list_of_hole_card_hands.length - 1)
|
322
|
-
list_of_hole_card_hands.each_index do |pos_rel_dealer|
|
323
|
-
position_difference = pos_rel_dealer - users_pos_rel_to_dealer
|
324
|
-
seat = (position_difference + @users_seat) % list_of_hole_card_hands.length
|
325
|
-
new_list[seat] = list_of_hole_card_hands[pos_rel_dealer]
|
326
|
-
end
|
327
|
-
|
328
|
-
new_list
|
329
|
-
end
|
330
|
-
def create_players(type, num_players)
|
331
|
-
num_players.times.inject([]) do |players, i|
|
332
|
-
name = "p#{i + 1}"
|
333
|
-
player_seat = i
|
334
|
-
players << Player.join_match(name, player_seat, GAME_DEFS[type][:stack_size])
|
335
|
-
end
|
336
|
-
end
|
337
|
-
def init_game_def!(type, players)
|
338
|
-
@game_def = mock 'GameDefinition'
|
339
|
-
@game_def.stubs(:first_player_positions).returns(GAME_DEFS[type][:first_player_positions])
|
340
|
-
@game_def.stubs(:number_of_players).returns(players.length)
|
341
|
-
@game_def.stubs(:blinds).returns(GAME_DEFS[type][:blinds])
|
342
|
-
@game_def.stubs(:chip_stacks).returns(players.map { |player| player.chip_stack })
|
343
|
-
@game_def.stubs(:min_wagers).returns(GAME_DEFS[type][:small_bets])
|
344
|
-
@game_def
|
345
|
-
end
|
346
|
-
def check_patient
|
347
|
-
check_players_at_the_table @patient.players_at_the_table
|
348
|
-
end
|
349
|
-
def check_players_at_the_table(players_at_the_table)
|
350
|
-
players_at_the_table.player_acting_sequence.should == @player_acting_sequence
|
351
|
-
players_at_the_table.number_of_players.should == @number_of_players
|
352
|
-
(players_at_the_table.players.map { |player| player.hole_cards }).should == @hole_card_hands
|
353
|
-
players_at_the_table.opponents_cards_visible?.should == @opponents_cards_visible
|
354
|
-
players_at_the_table.reached_showdown?.should == @reached_showdown
|
355
|
-
players_at_the_table.less_than_two_non_folded_players?.should == @less_than_two_non_folded_players
|
356
|
-
players_at_the_table.hand_ended?.should == @hand_ended
|
357
|
-
players_at_the_table.last_hand?.should == @last_hand
|
358
|
-
players_at_the_table.match_ended?.should == @match_ended
|
359
|
-
players_at_the_table.player_acting_sequence_string.should == @player_acting_sequence_string
|
360
|
-
players_at_the_table.users_turn_to_act?.should == @users_turn_to_act
|
361
|
-
players_at_the_table.chip_stacks.should == @chip_stacks
|
362
|
-
players_at_the_table.chip_balances.should == @chip_balances
|
363
|
-
players_at_the_table.betting_sequence.should == @betting_sequence
|
364
|
-
players_at_the_table.betting_sequence_string.should == @betting_sequence_string
|
365
|
-
players_at_the_table.chip_contributions.should == @chip_contributions
|
366
|
-
end
|
367
|
-
end
|
@@ -1,547 +0,0 @@
|
|
1
|
-
|
2
|
-
# require File.expand_path('../support/spec_helper', __FILE__)
|
3
|
-
|
4
|
-
# require 'acpc_poker_types/player'
|
5
|
-
# require 'acpc_poker_basic_proxy/basic_proxy'
|
6
|
-
# require 'acpc_poker_types/game_definition'
|
7
|
-
|
8
|
-
# require 'acpc_dealer'
|
9
|
-
# require 'acpc_dealer_data'
|
10
|
-
|
11
|
-
# require_relative '../lib/acpc_poker_player_proxy/player_proxy'
|
12
|
-
|
13
|
-
# describe PlayerProxy do
|
14
|
-
# PORT_NUMBER = 9001
|
15
|
-
# HOST_NAME = 'localhost'
|
16
|
-
# MILLISECOND_RESPONSE_TIMEOUT = 0
|
17
|
-
# DEALER_INFO = AcpcDealerInformation.new HOST_NAME, PORT_NUMBER, MILLISECOND_RESPONSE_TIMEOUT
|
18
|
-
|
19
|
-
# describe '#update!' do
|
20
|
-
# describe "keeps track of state for a sequence of match states and actions in Doyle's game" do
|
21
|
-
# it 'in no-limit' do
|
22
|
-
# @basic_proxy = mock 'BasicProxy'
|
23
|
-
# BasicProxy.stubs(:new).with(DEALER_INFO).returns(@basic_proxy)
|
24
|
-
|
25
|
-
# # Change this number to do more or less thorough tests.
|
26
|
-
# # Some interesting three player hands occur after 120
|
27
|
-
# # Careful though, even 10 hands takes about five seconds,
|
28
|
-
# # and it scales about linearly
|
29
|
-
# num_hands = 5
|
30
|
-
# match_logs.each do |log_description|
|
31
|
-
# @match = PokerMatchData.parse_files(
|
32
|
-
# log_description.actions_file_path,
|
33
|
-
# log_description.results_file_path,
|
34
|
-
# log_description.player_names,
|
35
|
-
# AcpcDealer::DEALER_DIRECTORY,
|
36
|
-
# num_hands
|
37
|
-
# )
|
38
|
-
# @match.for_every_seat! do |users_seat|
|
39
|
-
# @match.for_every_hand! do
|
40
|
-
# @match.current_hand.seat = users_seat
|
41
|
-
# @match.current_hand.turn_number = 0
|
42
|
-
|
43
|
-
# @basic_proxy.stubs(:receive_match_state!).returns(
|
44
|
-
# @match.current_hand.current_match_state
|
45
|
-
# )
|
46
|
-
# @patient = PlayerProxy.new(
|
47
|
-
# DEALER_INFO,
|
48
|
-
# users_seat,
|
49
|
-
# @match.match_def.game_def,
|
50
|
-
# @match.players.map { |player| player.name }.join(' '),
|
51
|
-
# num_hands
|
52
|
-
# ) do |patt|
|
53
|
-
# check_patient patt
|
54
|
-
|
55
|
-
# unless @match.current_hand.next_action.seat == users_seat
|
56
|
-
# @match.current_hand.turn_number += 1
|
57
|
-
# @basic_proxy.stubs(:receive_match_state!).returns(
|
58
|
-
# @match.current_hand.current_match_state
|
59
|
-
# )
|
60
|
-
# end
|
61
|
-
# end
|
62
|
-
|
63
|
-
# @basic_proxy.expects(:send_action).once.given(
|
64
|
-
# @match.current_hand.next_action.state,
|
65
|
-
# @match.current_hand.next_action.action.to_acpc
|
66
|
-
# )
|
67
|
-
# @patient.play! @match.current_hand.next_action.action.to_acpc do |patt|
|
68
|
-
# check_patient patt
|
69
|
-
|
70
|
-
# unless @match.current_hand.next_action.seat == users_seat
|
71
|
-
# @match.current_hand.turn_number += 1
|
72
|
-
# @basic_proxy.stubs(:receive_match_state!).returns(
|
73
|
-
# @match.current_hand.current_match_state
|
74
|
-
# )
|
75
|
-
# end
|
76
|
-
# end
|
77
|
-
# end
|
78
|
-
# end
|
79
|
-
# end
|
80
|
-
# end
|
81
|
-
# end
|
82
|
-
# end
|
83
|
-
|
84
|
-
# def check_turns_of_given_type!(seat, type, data_by_type)
|
85
|
-
# @hand_num = 0
|
86
|
-
# @users_seat = seat.to_i - 1
|
87
|
-
|
88
|
-
# turns = data_by_type[:actions]
|
89
|
-
|
90
|
-
# init_before_first_turn_data! @number_of_players, type
|
91
|
-
|
92
|
-
# init_game_def! type, @players
|
93
|
-
# GameDefinition.stubs(:new).with(@game_def).returns(@game_def)
|
94
|
-
|
95
|
-
# @basic_proxy = mock 'BasicProxy'
|
96
|
-
# BasicProxy.stubs(:new).with(DEALER_INFO).returns(@basic_proxy)
|
97
|
-
|
98
|
-
# Player.stubs(:create_players).with(
|
99
|
-
# @players.map{|p| p.name}, @game_def
|
100
|
-
# ).returns(@players)
|
101
|
-
|
102
|
-
# @expected_players_at_the_table = PlayersAtTheTable.seat_players(
|
103
|
-
# @game_def, @players.map{|p| p.name}, @users_seat, GAME_DEFS[type][:number_of_hands]
|
104
|
-
# )
|
105
|
-
|
106
|
-
# players_for_patient = create_players type, @number_of_players
|
107
|
-
|
108
|
-
# Player.stubs(:create_players).with(
|
109
|
-
# players_for_patient.map{|p| p.name}, @game_def
|
110
|
-
# ).returns(players_for_patient)
|
111
|
-
|
112
|
-
# i = 0
|
113
|
-
# @patient = PlayerProxy.new(
|
114
|
-
# DEALER_INFO,
|
115
|
-
# @users_seat,
|
116
|
-
# @game_def,
|
117
|
-
# (@players.map{ |player| player.name }).join(' '),
|
118
|
-
# GAME_DEFS[type][:number_of_hands]
|
119
|
-
# ) do |players_at_the_table|
|
120
|
-
# check_players_at_the_table players_at_the_table
|
121
|
-
|
122
|
-
# unless players_at_the_table.users_turn_to_act? || players_at_the_table.match_ended?
|
123
|
-
# i = check_turn! i, turns, seat, type, data_by_type
|
124
|
-
# end
|
125
|
-
# end
|
126
|
-
|
127
|
-
# # @todo match ended won't be restricted once data is separated better by game def
|
128
|
-
# while (i < turns.length) && !@match_ended
|
129
|
-
# i = check_turn! i, turns, seat, type, data_by_type
|
130
|
-
# end
|
131
|
-
# end
|
132
|
-
# def check_turn!(i, turns, seat, type, data_by_type)
|
133
|
-
# return i+1 if @match_ended
|
134
|
-
|
135
|
-
# turn = turns[i]
|
136
|
-
# next_turn = turns[i + 1]
|
137
|
-
# from_player_message = turn[:from_players]
|
138
|
-
# match_state = turn[:to_players][seat]
|
139
|
-
# prev_round = if @last_match_state then @last_match_state.round else nil end
|
140
|
-
|
141
|
-
# @last_hand = ((GAME_DEFS[type][:number_of_hands] - 1) == @hand_num)
|
142
|
-
|
143
|
-
# @next_player_to_act = if index_of_next_player_to_act(next_turn) < 0
|
144
|
-
# nil
|
145
|
-
# else
|
146
|
-
# @players[index_of_next_player_to_act(next_turn)]
|
147
|
-
# end
|
148
|
-
# @users_turn_to_act = if @next_player_to_act
|
149
|
-
# @next_player_to_act.seat == @users_seat
|
150
|
-
# else
|
151
|
-
# false
|
152
|
-
# end
|
153
|
-
|
154
|
-
# @last_match_state = MatchState.parse match_state
|
155
|
-
|
156
|
-
# @hole_card_hands = order_by_seat_from_dealer_relative @last_match_state.list_of_hole_card_hands,
|
157
|
-
# @last_match_state.position_relative_to_dealer
|
158
|
-
|
159
|
-
# if @last_match_state.first_state_of_first_round?
|
160
|
-
# init_new_hand_data! type
|
161
|
-
# else
|
162
|
-
# init_new_turn_data! type, from_player_message, prev_round
|
163
|
-
# end
|
164
|
-
|
165
|
-
# if @last_match_state.round != prev_round || @last_match_state.first_state_of_first_round?
|
166
|
-
# @player_acting_sequence << []
|
167
|
-
# @betting_sequence << []
|
168
|
-
# end
|
169
|
-
|
170
|
-
# if !next_turn || MatchState.parse(next_turn[:to_players]['1']).first_state_of_first_round?
|
171
|
-
# init_hand_result_data! data_by_type
|
172
|
-
# end
|
173
|
-
|
174
|
-
# @expected_players_at_the_table.update! @last_match_state
|
175
|
-
|
176
|
-
# init_after_update_data! type
|
177
|
-
|
178
|
-
# @basic_proxy.expects(:receive_match_state!).returns(@last_match_state)
|
179
|
-
|
180
|
-
# return i+1 if from_player_message.empty?
|
181
|
-
|
182
|
-
# seat_taking_action = from_player_message.keys.first
|
183
|
-
|
184
|
-
# return i+1 unless seat_taking_action == seat
|
185
|
-
|
186
|
-
# action = PokerAction.new from_player_message[seat_taking_action]
|
187
|
-
|
188
|
-
# @basic_proxy.expects(:send_action).with(action)
|
189
|
-
|
190
|
-
# i += 1
|
191
|
-
# @patient.play!(action) do |players_at_the_table|
|
192
|
-
# check_players_at_the_table players_at_the_table
|
193
|
-
|
194
|
-
# i = check_turn! i, turns, seat, type, data_by_type
|
195
|
-
# end
|
196
|
-
|
197
|
-
# i
|
198
|
-
# end
|
199
|
-
|
200
|
-
|
201
|
-
# def init_after_update_data!(type)
|
202
|
-
# @active_players = @players.select { |player| player.active? }
|
203
|
-
# @non_folded_players = @players.select { |player| !player.folded? }
|
204
|
-
# @opponents_cards_visible = @opponents.any? { |player| !player.hole_cards.empty? }
|
205
|
-
# @reached_showdown = @opponents_cards_visible
|
206
|
-
# @less_than_two_non_folded_players = @non_folded_players.length < 2
|
207
|
-
# @hand_ended = @less_than_two_non_folded_players || @reached_showdown
|
208
|
-
# @match_ended = @hand_ended && @last_hand
|
209
|
-
# @player_with_dealer_button = nil
|
210
|
-
# @players.each_index do |j|
|
211
|
-
# if positions_relative_to_dealer[j] == @players.length - 1
|
212
|
-
# @player_with_dealer_button = @players[j]
|
213
|
-
# end
|
214
|
-
# end
|
215
|
-
# @player_blind_relation = @players.inject({}) do |hash, player|
|
216
|
-
# hash[player] = GAME_DEFS[type][:blinds][positions_relative_to_dealer[player.seat]]
|
217
|
-
# hash
|
218
|
-
# end
|
219
|
-
# end
|
220
|
-
# def init_hand_result_data!(data_by_type)
|
221
|
-
# result = data_by_type[:results][@hand_num]
|
222
|
-
# @hand_num += 1
|
223
|
-
|
224
|
-
# result.each do |player_name, final_balance|
|
225
|
-
# # @todo This assumption isn't robust yet
|
226
|
-
# player = @players.find { |p| p.name == player_name }
|
227
|
-
|
228
|
-
# # @todo Only in Doyle's game
|
229
|
-
# @chip_stacks[player.seat] =
|
230
|
-
# @game_def.chip_stacks[positions_relative_to_dealer[player.seat]].to_r +
|
231
|
-
# final_balance.to_r
|
232
|
-
|
233
|
-
# # @todo Assumes Doyle's game in three player
|
234
|
-
# if final_balance.to_r == 0
|
235
|
-
# @chip_balances[player.seat] = @last_hands_balance[player.seat].to_r
|
236
|
-
# @chip_contributions[player.seat] << -@chip_contributions[player.seat].sum
|
237
|
-
# elsif final_balance.to_r > 0
|
238
|
-
# @chip_balances[player.seat] = @last_hands_balance[player.seat].to_r + final_balance.to_r
|
239
|
-
# @chip_contributions[player.seat] << -@chip_contributions.mapped_sum.sum
|
240
|
-
# end
|
241
|
-
|
242
|
-
# @last_hands_balance[player.seat] = @chip_balances[player.seat]
|
243
|
-
# end
|
244
|
-
# end
|
245
|
-
# def init_new_turn_data!(type, from_player_message, prev_round)
|
246
|
-
# @betting_sequence << [] if @betting_sequence.empty?
|
247
|
-
# @player_acting_sequence << [] if @player_acting_sequence.empty?
|
248
|
-
|
249
|
-
# seat_taking_action = from_player_message.keys.first
|
250
|
-
# seat_of_last_player_to_act = seat_taking_action.to_i - 1
|
251
|
-
# @player_who_acted_last = @players[seat_of_last_player_to_act]
|
252
|
-
|
253
|
-
# @last_action = PokerAction.new(
|
254
|
-
# from_player_message[seat_taking_action], {
|
255
|
-
# amount_to_put_in_pot: @expected_players_at_the_table.cost_of_action(
|
256
|
-
# @player_who_acted_last,
|
257
|
-
# PokerAction.new(from_player_message[seat_taking_action]), (
|
258
|
-
# @betting_sequence.length - 1
|
259
|
-
# )
|
260
|
-
# ),
|
261
|
-
# acting_player_sees_wager: (
|
262
|
-
# @expected_players_at_the_table.amount_to_call(@player_who_acted_last) > 0 || (
|
263
|
-
# GAME_DEFS[type][:blinds][positions_relative_to_dealer[seat_of_last_player_to_act]] > 0 && (
|
264
|
-
# @player_who_acted_last.actions_taken_this_hand[0].length < 1
|
265
|
-
# )
|
266
|
-
# )
|
267
|
-
# )
|
268
|
-
# }
|
269
|
-
# )
|
270
|
-
|
271
|
-
# @chip_contributions[seat_of_last_player_to_act][-1] += @last_action.amount_to_put_in_pot.to_r
|
272
|
-
# @chip_stacks[seat_of_last_player_to_act] -= @last_action.amount_to_put_in_pot
|
273
|
-
# @chip_balances[seat_of_last_player_to_act] -= @last_action.amount_to_put_in_pot.to_r
|
274
|
-
|
275
|
-
# @player_acting_sequence.last << seat_of_last_player_to_act
|
276
|
-
# @player_acting_sequence_string += seat_of_last_player_to_act.to_s
|
277
|
-
# @betting_sequence.last << @last_action
|
278
|
-
# @betting_sequence_string += @last_action.to_acpc
|
279
|
-
|
280
|
-
# if @last_match_state.round != prev_round
|
281
|
-
# @player_acting_sequence_string += '/'
|
282
|
-
# @betting_sequence_string += '/'
|
283
|
-
# @chip_contributions.each do |contribution|
|
284
|
-
# contribution << 0
|
285
|
-
# end
|
286
|
-
# end
|
287
|
-
# end
|
288
|
-
# def init_new_hand_data!(type)
|
289
|
-
# @player_who_acted_last = nil
|
290
|
-
|
291
|
-
# @player_acting_sequence = []
|
292
|
-
# @player_acting_sequence_string = ''
|
293
|
-
|
294
|
-
# @betting_sequence = []
|
295
|
-
# @betting_sequence_string = ''
|
296
|
-
|
297
|
-
# init_new_hand_chip_data! type
|
298
|
-
# end
|
299
|
-
# def init_new_hand_chip_data!(type)
|
300
|
-
# # @todo Assumes Doyle's Game
|
301
|
-
# @chip_stacks = @players.each_index.inject([]) { |stacks, j| stacks << GAME_DEFS[type][:stack_size] }
|
302
|
-
# @chip_contributions = []
|
303
|
-
# @chip_stacks.each_index do |j|
|
304
|
-
# @chip_stacks[j] -= GAME_DEFS[type][:blinds][positions_relative_to_dealer[j]]
|
305
|
-
# @chip_balances[j] -= GAME_DEFS[type][:blinds][positions_relative_to_dealer[j]].to_r
|
306
|
-
# @chip_contributions << [GAME_DEFS[type][:blinds][positions_relative_to_dealer[j]].to_r]
|
307
|
-
# end
|
308
|
-
# end
|
309
|
-
# def init_before_first_turn_data!(num_players, type)
|
310
|
-
# @last_hands_balance = num_players.times.inject([]) { |balances, i| balances << 0 }
|
311
|
-
# @players = create_players(type, num_players)
|
312
|
-
# @chip_balances = @players.map { |player| player.chip_balance.to_r }
|
313
|
-
# @chip_contributions = @players.map { |player| player.chip_contributions }
|
314
|
-
# @user_player = @players[@users_seat]
|
315
|
-
# @opponents = @players.select { |player| !player.eql?(@user_player) }
|
316
|
-
# @hole_card_hands = @players.inject([]) { |hands, player| hands << player.hole_cards }
|
317
|
-
# @opponents_cards_visible = false
|
318
|
-
# @reached_showdown = @opponents_cards_visible
|
319
|
-
# @less_than_two_non_folded_players = false
|
320
|
-
# @hand_ended = @less_than_two_non_folded_players || @reached_showdown
|
321
|
-
# @last_hand = false
|
322
|
-
# @match_ended = @hand_ended && @last_hand
|
323
|
-
# @active_players = @players
|
324
|
-
# @non_folded_players = @players
|
325
|
-
# @player_acting_sequence = [[]]
|
326
|
-
# @player_acting_sequence_string = ''
|
327
|
-
# @users_turn_to_act = false
|
328
|
-
# @chip_stacks = @players.map { |player| player.chip_stack }
|
329
|
-
# @betting_sequence = [[]]
|
330
|
-
# @betting_sequence_string = ''
|
331
|
-
# @player_who_acted_last = nil
|
332
|
-
# @next_player_to_act = nil
|
333
|
-
# @player_with_dealer_button = nil
|
334
|
-
# @player_blind_relation = nil
|
335
|
-
# end
|
336
|
-
# def index_of_next_player_to_act(turn) turn[:from_players].keys.first.to_r - 1 end
|
337
|
-
# def positions_relative_to_dealer
|
338
|
-
# positions = []
|
339
|
-
# @last_match_state.list_of_hole_card_hands.each_index do |pos_rel_dealer|
|
340
|
-
# @hole_card_hands.each_index do |seat|
|
341
|
-
# if @hole_card_hands[seat] == @last_match_state.list_of_hole_card_hands[pos_rel_dealer]
|
342
|
-
# positions[seat] = pos_rel_dealer
|
343
|
-
# end
|
344
|
-
# end
|
345
|
-
# @last_match_state.list_of_hole_card_hands
|
346
|
-
# end
|
347
|
-
# positions
|
348
|
-
# end
|
349
|
-
# def order_by_seat_from_dealer_relative(list_of_hole_card_hands,
|
350
|
-
# users_pos_rel_to_dealer)
|
351
|
-
# new_list = [].fill Hand.new, (0..list_of_hole_card_hands.length - 1)
|
352
|
-
# list_of_hole_card_hands.each_index do |pos_rel_dealer|
|
353
|
-
# position_difference = pos_rel_dealer - users_pos_rel_to_dealer
|
354
|
-
# seat = (position_difference + @users_seat) % list_of_hole_card_hands.length
|
355
|
-
# new_list[seat] = list_of_hole_card_hands[pos_rel_dealer]
|
356
|
-
# end
|
357
|
-
|
358
|
-
# new_list
|
359
|
-
# end
|
360
|
-
# def create_players(type, num_players)
|
361
|
-
# num_players.times.inject([]) do |players, i|
|
362
|
-
# name = "p#{i + 1}"
|
363
|
-
# player_seat = i
|
364
|
-
# players << Player.join_match(name, player_seat, GAME_DEFS[type][:stack_size])
|
365
|
-
# end
|
366
|
-
# end
|
367
|
-
# def init_game_def!(type, players)
|
368
|
-
# @game_def = mock 'GameDefinition'
|
369
|
-
# @game_def.stubs(:first_player_positions).returns(GAME_DEFS[type][:first_player_positions])
|
370
|
-
# @game_def.stubs(:number_of_players).returns(players.length)
|
371
|
-
# @game_def.stubs(:blinds).returns(GAME_DEFS[type][:blinds])
|
372
|
-
# @game_def.stubs(:chip_stacks).returns(players.map { |player| player.chip_stack })
|
373
|
-
# @game_def.stubs(:min_wagers).returns(GAME_DEFS[type][:small_bets])
|
374
|
-
# @game_def
|
375
|
-
# end
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
# def check_patient
|
380
|
-
# check_players_at_the_table
|
381
|
-
# end
|
382
|
-
# def check_players_at_the_table(patient=@patient.players_at_the_table)
|
383
|
-
# patient.player_acting_sequence.must_equal @match.player_acting_sequence
|
384
|
-
# patient.number_of_players.must_equal @match.players.length
|
385
|
-
# check_last_action
|
386
|
-
# check_next_to_act
|
387
|
-
# check_last_turn
|
388
|
-
# patient.opponents_cards_visible?.must_equal @match.opponents_cards_visible?
|
389
|
-
# patient.reached_showdown?.must_equal @match.opponents_cards_visible?
|
390
|
-
# patient.less_than_two_non_folded_players?.must_equal @match.non_folded_players.length < 2
|
391
|
-
|
392
|
-
# if @match.current_hand
|
393
|
-
# patient.hand_ended?.must_equal @match.current_hand.final_turn?
|
394
|
-
# patient.match_ended?.must_equal (@match.final_hand? && @match.current_hand.final_turn?)
|
395
|
-
# end
|
396
|
-
# patient.last_hand?.must_equal (
|
397
|
-
# if @match.final_hand?.nil?
|
398
|
-
# false
|
399
|
-
# else
|
400
|
-
# @match.final_hand?
|
401
|
-
# end
|
402
|
-
# )
|
403
|
-
# patient.player_acting_sequence_string.must_equal @match.player_acting_sequence_string
|
404
|
-
# patient.users_turn_to_act?.must_equal @match.users_turn_to_act?
|
405
|
-
# check_betting_sequence(patient)
|
406
|
-
# # @todo Test this eventually
|
407
|
-
# # patient.min_wager.to_i.must_equal @min_wager.to_i
|
408
|
-
# end
|
409
|
-
# def check_player_blind_relation(patient)
|
410
|
-
# expected_player_blind_relation = @match.player_blind_relation
|
411
|
-
# patient.player_blind_relation.each do |player, blind|
|
412
|
-
# expected_player_and_blind = expected_player_blind_relation.to_a.find do |player_and_blind|
|
413
|
-
# player_and_blind.first.seat == player.seat
|
414
|
-
# end
|
415
|
-
|
416
|
-
# expected_player = expected_player_and_blind.first
|
417
|
-
# expected_blind = expected_player_and_blind.last
|
418
|
-
|
419
|
-
# player.close_enough?(expected_player).must_equal true
|
420
|
-
# blind.must_equal expected_blind
|
421
|
-
# end
|
422
|
-
# end
|
423
|
-
# def check_betting_sequence(patient)
|
424
|
-
# patient_betting_sequence = patient.betting_sequence.map do |actions|
|
425
|
-
# actions.map { |action| action.to_low_res_acpc }
|
426
|
-
# end
|
427
|
-
# expected_betting_sequence = @match.betting_sequence.map do |actions|
|
428
|
-
# actions.map { |action| action.to_low_res_acpc }
|
429
|
-
# end
|
430
|
-
# patient_betting_sequence.must_equal expected_betting_sequence
|
431
|
-
|
432
|
-
# patient.betting_sequence_string.scan(/([a-z]\d*|\/)/).flatten.map do |action|
|
433
|
-
# if action.match(/\//)
|
434
|
-
# action
|
435
|
-
# else
|
436
|
-
# PokerAction.new(action).to_low_res_acpc
|
437
|
-
# end
|
438
|
-
# end.join('').must_equal @match.betting_sequence_string
|
439
|
-
# end
|
440
|
-
# def check_last_action(patient=@patient)
|
441
|
-
# if @match.current_hand && @match.current_hand.last_action
|
442
|
-
# patient.player_who_acted_last.seat.must_equal @match.current_hand.last_action.seat
|
443
|
-
# else
|
444
|
-
# patient.player_who_acted_last.must_be_nil
|
445
|
-
# end
|
446
|
-
# end
|
447
|
-
# def check_next_to_act(patient=@patient)
|
448
|
-
# if @match.current_hand && @match.current_hand.next_action
|
449
|
-
# patient.next_player_to_act.seat.must_equal @match.current_hand.next_action.seat
|
450
|
-
# else
|
451
|
-
# patient.next_player_to_act.must_be_nil
|
452
|
-
# end
|
453
|
-
# end
|
454
|
-
# def check_last_turn(patient=@patient)
|
455
|
-
# return unless @match.current_hand && @match.current_hand.final_turn?
|
456
|
-
# patient.players.players_close_enough?(@match.players).must_equal true
|
457
|
-
# patient.user_player.close_enough?(@match.player).must_equal true
|
458
|
-
# patient.opponents.players_close_enough?(@match.opponents).must_equal true
|
459
|
-
# patient.non_folded_players.players_close_enough?(@match.non_folded_players).must_equal true
|
460
|
-
# patient.active_players.players_close_enough?(@match.active_players).must_equal true
|
461
|
-
# patient.player_with_dealer_button.close_enough?(@match.player_with_dealer_button).must_equal true
|
462
|
-
# check_player_blind_relation(patient)
|
463
|
-
# patient.chip_stacks.must_equal @match.chip_stacks
|
464
|
-
# patient.chip_balances.must_equal @match.chip_balances
|
465
|
-
# patient.chip_contributions.sum.must_equal @match.chip_contributions.sum
|
466
|
-
# end
|
467
|
-
# end
|
468
|
-
|
469
|
-
# class Array
|
470
|
-
# def players_close_enough?(other_players)
|
471
|
-
# return false if other_players.length != length
|
472
|
-
# each_with_index do |player, index|
|
473
|
-
# return false unless player.close_enough?(other_players[index])
|
474
|
-
# end
|
475
|
-
# true
|
476
|
-
# end
|
477
|
-
# def reject_empty_elements
|
478
|
-
# reject do |elem|
|
479
|
-
# elem.empty?
|
480
|
-
# end
|
481
|
-
# end
|
482
|
-
# end
|
483
|
-
|
484
|
-
# class PokerAction
|
485
|
-
# # @return [Hash] Map of specific to general actions to more specific actions (e.g. check to call and bet to raise).
|
486
|
-
# LOW_RESOLUTION_ACTION_CONVERSION = {call: :call, raise: :raise, fold: :fold, check: :call, bet: :raise}
|
487
|
-
|
488
|
-
# def to_low_res_acpc
|
489
|
-
# LEGAL_ACTIONS[LOW_RESOLUTION_ACTION_CONVERSION[@symbol]] + @modifier.to_s
|
490
|
-
# end
|
491
|
-
# end
|
492
|
-
# class Player
|
493
|
-
# def acpc_actions_taken_this_hand
|
494
|
-
# acpc_actions = @actions_taken_this_hand.map do |actions_per_turn|
|
495
|
-
# actions_per_turn.map { |action| action.to_low_res_acpc }
|
496
|
-
# end
|
497
|
-
# if acpc_actions.first.empty?
|
498
|
-
# acpc_actions
|
499
|
-
# else
|
500
|
-
# acpc_actions.reject_empty_elements
|
501
|
-
# end
|
502
|
-
# end
|
503
|
-
|
504
|
-
# def close_enough?(other)
|
505
|
-
|
506
|
-
# unless (@name == other.name &&
|
507
|
-
# @seat == other.seat &&
|
508
|
-
# @chip_stack == other.chip_stack &&
|
509
|
-
# @chip_balance == other.chip_balance &&
|
510
|
-
# acpc_actions_taken_this_hand == other.acpc_actions_taken_this_hand)
|
511
|
-
# puts "name: #{name == other.name}"
|
512
|
-
# puts "seat: #{seat == other.seat}"
|
513
|
-
# puts "chip_stack: #{chip_stack}, other: #{other.chip_stack}"
|
514
|
-
# puts "chip balances: #{chip_balance}, other: #{other.chip_balance}"
|
515
|
-
# puts "actions_taken_this_hand: #{acpc_actions_taken_this_hand}, other: #{other.acpc_actions_taken_this_hand}"
|
516
|
-
# puts "all_in: #{all_in?}, other: #{other.all_in?}"
|
517
|
-
# end
|
518
|
-
|
519
|
-
|
520
|
-
# @name == other.name &&
|
521
|
-
# @seat == other.seat &&
|
522
|
-
# @chip_stack == other.chip_stack &&
|
523
|
-
# @chip_balance == other.chip_balance &&
|
524
|
-
# acpc_actions_taken_this_hand == other.acpc_actions_taken_this_hand
|
525
|
-
# end
|
526
|
-
# end
|
527
|
-
|
528
|
-
|
529
|
-
# # def check_players_at_the_table(players_at_the_table)
|
530
|
-
# # players_at_the_table.player_acting_sequence.should == @player_acting_sequence
|
531
|
-
# # players_at_the_table.number_of_players.should == @number_of_players
|
532
|
-
# # (players_at_the_table.players.map { |player| player.hole_cards }).should == @hole_card_hands
|
533
|
-
# # players_at_the_table.opponents_cards_visible?.should == @opponents_cards_visible
|
534
|
-
# # players_at_the_table.reached_showdown?.should == @reached_showdown
|
535
|
-
# # players_at_the_table.less_than_two_non_folded_players?.should == @less_than_two_non_folded_players
|
536
|
-
# # players_at_the_table.hand_ended?.should == @hand_ended
|
537
|
-
# # players_at_the_table.last_hand?.should == @last_hand
|
538
|
-
# # players_at_the_table.match_ended?.should == @match_ended
|
539
|
-
# # players_at_the_table.player_acting_sequence_string.should == @player_acting_sequence_string
|
540
|
-
# # players_at_the_table.users_turn_to_act?.should == @users_turn_to_act
|
541
|
-
# # players_at_the_table.chip_stacks.should == @chip_stacks
|
542
|
-
# # players_at_the_table.chip_balances.should == @chip_balances
|
543
|
-
# # players_at_the_table.betting_sequence.should == @betting_sequence
|
544
|
-
# # players_at_the_table.betting_sequence_string.should == @betting_sequence_string
|
545
|
-
# # players_at_the_table.chip_contributions.should == @chip_contributions
|
546
|
-
# # end
|
547
|
-
|