acpc_poker_types 6.2.3 → 7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/acpc_poker_types.rb +2 -2
- data/lib/acpc_poker_types/dealer_data.rb +9 -0
- data/lib/acpc_poker_types/{acpc_dealer_data → dealer_data}/action_messages.rb +10 -10
- data/lib/acpc_poker_types/{acpc_dealer_data → dealer_data}/hand_data.rb +4 -4
- data/lib/acpc_poker_types/{acpc_dealer_data → dealer_data}/hand_results.rb +8 -8
- data/lib/acpc_poker_types/{acpc_dealer_data → dealer_data}/log_file.rb +1 -1
- data/lib/acpc_poker_types/{acpc_dealer_data → dealer_data}/match_definition.rb +1 -1
- data/lib/acpc_poker_types/{acpc_dealer_data → dealer_data}/poker_match_data.rb +44 -56
- data/lib/acpc_poker_types/{player_group.rb → hand_player_group.rb} +1 -1
- data/lib/acpc_poker_types/match_state.rb +11 -8
- data/lib/acpc_poker_types/player.rb +50 -0
- data/lib/acpc_poker_types/players_at_the_table.rb +168 -0
- data/lib/acpc_poker_types/version.rb +1 -1
- data/spec/{action_messages_spec.rb → dealer_data/action_messages_spec.rb} +60 -61
- data/spec/{hand_data_spec.rb → dealer_data/hand_data_spec.rb} +26 -27
- data/spec/{hand_results_spec.rb → dealer_data/hand_results_spec.rb} +17 -18
- data/spec/{match_definition_spec.rb → dealer_data/match_definition_spec.rb} +10 -11
- data/spec/{poker_match_data_spec.rb → dealer_data/poker_match_data_spec.rb} +48 -7
- data/spec/{player_group_spec.rb → hand_player_group_spec.rb} +3 -10
- data/spec/hand_player_spec.rb +1 -1
- data/spec/match_state_spec.rb +118 -76
- data/spec/player_spec.rb +45 -0
- data/spec/players_at_the_table_spec.rb +133 -0
- metadata +60 -136
- data/lib/acpc_poker_types/acpc_dealer_data.rb +0 -9
- data/spec/coverage/assets/0.7.1/application.css +0 -1110
- data/spec/coverage/assets/0.7.1/application.js +0 -626
- data/spec/coverage/assets/0.7.1/fancybox/blank.gif +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancy_close.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancy_loading.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancy_nav_left.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancy_nav_right.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancy_shadow_e.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancy_shadow_n.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancy_shadow_ne.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancy_shadow_nw.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancy_shadow_s.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancy_shadow_se.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancy_shadow_sw.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancy_shadow_w.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancy_title_left.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancy_title_main.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancy_title_over.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancy_title_right.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancybox-x.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancybox-y.png +0 -0
- data/spec/coverage/assets/0.7.1/fancybox/fancybox.png +0 -0
- data/spec/coverage/assets/0.7.1/favicon_green.png +0 -0
- data/spec/coverage/assets/0.7.1/favicon_red.png +0 -0
- data/spec/coverage/assets/0.7.1/favicon_yellow.png +0 -0
- data/spec/coverage/assets/0.7.1/loading.gif +0 -0
- data/spec/coverage/assets/0.7.1/magnify.png +0 -0
- data/spec/coverage/assets/0.7.1/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/spec/coverage/assets/0.7.1/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/spec/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/spec/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/spec/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/spec/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/spec/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/spec/coverage/assets/0.7.1/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/spec/coverage/assets/0.7.1/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/spec/coverage/assets/0.7.1/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/spec/coverage/assets/0.7.1/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/spec/coverage/assets/0.7.1/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/spec/coverage/assets/0.7.1/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/spec/coverage/index.html +0 -72
data/spec/hand_player_spec.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
require_relative 'support/spec_helper'
|
4
4
|
|
5
5
|
require 'acpc_dealer'
|
6
|
-
require 'acpc_poker_types/
|
6
|
+
require 'acpc_poker_types/dealer_data/poker_match_data'
|
7
7
|
|
8
8
|
require 'acpc_poker_types/hand_player'
|
9
9
|
require 'acpc_poker_types/poker_action'
|
data/spec/match_state_spec.rb
CHANGED
@@ -9,7 +9,7 @@ require_relative "../lib/acpc_poker_types/suit"
|
|
9
9
|
require_relative "../lib/acpc_poker_types/hand"
|
10
10
|
require_relative "../lib/acpc_poker_types/card"
|
11
11
|
require_relative "../lib/acpc_poker_types/game_definition"
|
12
|
-
require_relative "../lib/acpc_poker_types/
|
12
|
+
require_relative "../lib/acpc_poker_types/dealer_data/poker_match_data"
|
13
13
|
|
14
14
|
module MapWithIndex
|
15
15
|
refine Array do
|
@@ -144,6 +144,12 @@ describe MatchState do
|
|
144
144
|
betting += "c/"
|
145
145
|
end
|
146
146
|
end
|
147
|
+
it "properly reports the current round number when players are all-in" do
|
148
|
+
x_match_state = "#{MatchState::LABEL}:0:0:rc///:#{arbitrary_hole_card_hand}|#{arbitrary_hole_card_hand}"
|
149
|
+
patient = test_match_state_success(x_match_state)
|
150
|
+
patient.round.must_equal 3
|
151
|
+
patient.to_s.must_equal x_match_state
|
152
|
+
end
|
147
153
|
end
|
148
154
|
|
149
155
|
it 'reports the correct number of players' do
|
@@ -211,7 +217,7 @@ describe MatchState do
|
|
211
217
|
it 'receives matchstate strings properly' do
|
212
218
|
@connection = mock 'Socket'
|
213
219
|
MatchLog.all.each do |log_description|
|
214
|
-
match =
|
220
|
+
match = DealerData::PokerMatchData.parse_files(
|
215
221
|
log_description.actions_file_path,
|
216
222
|
log_description.results_file_path,
|
217
223
|
log_description.player_names,
|
@@ -231,7 +237,7 @@ describe MatchState do
|
|
231
237
|
end
|
232
238
|
end
|
233
239
|
describe '#betting_sequence' do
|
234
|
-
it 'works' do
|
240
|
+
it 'works for normal play' do
|
235
241
|
MatchState.parse(
|
236
242
|
"#{MatchState::LABEL}:0:0:crcc/ccc/rrfc:AhKs|"
|
237
243
|
).betting_sequence.must_equal [
|
@@ -254,6 +260,41 @@ describe MatchState do
|
|
254
260
|
]
|
255
261
|
]
|
256
262
|
end
|
263
|
+
it 'works when players are all-in' do
|
264
|
+
wager_size = 10
|
265
|
+
x_game_def = GameDefinition.new(
|
266
|
+
first_player_positions: [3, 2, 2, 2],
|
267
|
+
chip_stacks: [100, 200, 150],
|
268
|
+
blinds: [0, 10, 5],
|
269
|
+
raise_sizes: [wager_size]*4,
|
270
|
+
number_of_ranks: 3
|
271
|
+
)
|
272
|
+
|
273
|
+
(0..x_game_def.number_of_players-1).each do |position|
|
274
|
+
hands = x_game_def.number_of_players.times.map { arbitrary_hole_card_hand }
|
275
|
+
|
276
|
+
hand_string = hands.inject('') do |hand_string, hand|
|
277
|
+
hand_string << "#{hand}#{MatchState::HAND_SEPARATOR}"
|
278
|
+
end[0..-2]
|
279
|
+
|
280
|
+
match_state =
|
281
|
+
"#{MatchState::LABEL}:#{position}:0:cr200cc///:#{hand_string}"
|
282
|
+
|
283
|
+
MatchState.new(match_state).betting_sequence.must_equal(
|
284
|
+
[
|
285
|
+
[
|
286
|
+
PokerAction.new('c'),
|
287
|
+
PokerAction.new('r200'),
|
288
|
+
PokerAction.new('c'),
|
289
|
+
PokerAction.new('c')
|
290
|
+
],
|
291
|
+
[],
|
292
|
+
[],
|
293
|
+
[]
|
294
|
+
]
|
295
|
+
)
|
296
|
+
end
|
297
|
+
end
|
257
298
|
end
|
258
299
|
describe '#players_at_hand_start' do
|
259
300
|
it 'returns HandPlayers with states set at the beginning of the hand' do
|
@@ -605,7 +646,7 @@ describe MatchState do
|
|
605
646
|
end
|
606
647
|
end
|
607
648
|
describe '#player_acting_sequence' do
|
608
|
-
it 'works' do
|
649
|
+
it 'works for normal play' do
|
609
650
|
wager_size = 10
|
610
651
|
x_game_def = GameDefinition.new(
|
611
652
|
first_player_positions: [3, 2, 2, 2],
|
@@ -616,78 +657,6 @@ describe MatchState do
|
|
616
657
|
)
|
617
658
|
|
618
659
|
(0..x_game_def.number_of_players-1).each do |position|
|
619
|
-
x_actions = [
|
620
|
-
{
|
621
|
-
action: PokerAction.new(PokerAction::CALL, cost: 5),
|
622
|
-
round: 0,
|
623
|
-
acting_player_position: 2
|
624
|
-
},
|
625
|
-
{
|
626
|
-
action: PokerAction.new(PokerAction::RAISE, cost: wager_size + 10),
|
627
|
-
round: 0,
|
628
|
-
acting_player_position: 0
|
629
|
-
},
|
630
|
-
{
|
631
|
-
action: PokerAction.new(PokerAction::CALL, cost: wager_size),
|
632
|
-
round: 0,
|
633
|
-
acting_player_position: 1
|
634
|
-
},
|
635
|
-
{
|
636
|
-
action: PokerAction.new(PokerAction::CALL, cost: wager_size),
|
637
|
-
round: 0,
|
638
|
-
acting_player_position: 2
|
639
|
-
},
|
640
|
-
{
|
641
|
-
action: PokerAction.new(PokerAction::CHECK),
|
642
|
-
round: 1,
|
643
|
-
acting_player_position: 1
|
644
|
-
},
|
645
|
-
{
|
646
|
-
action: PokerAction.new(PokerAction::CHECK),
|
647
|
-
round: 1,
|
648
|
-
acting_player_position: 2
|
649
|
-
},
|
650
|
-
{
|
651
|
-
action: PokerAction.new(PokerAction::CHECK),
|
652
|
-
round: 1,
|
653
|
-
acting_player_position: 0
|
654
|
-
},
|
655
|
-
{
|
656
|
-
action: PokerAction.new(PokerAction::BET, cost: wager_size),
|
657
|
-
round: 2,
|
658
|
-
acting_player_position: 1
|
659
|
-
},
|
660
|
-
{
|
661
|
-
action: PokerAction.new(PokerAction::RAISE, cost: 2 * wager_size),
|
662
|
-
round: 2,
|
663
|
-
acting_player_position: 2
|
664
|
-
},
|
665
|
-
{
|
666
|
-
action: PokerAction.new(PokerAction::FOLD),
|
667
|
-
round: 2,
|
668
|
-
acting_player_position: 0
|
669
|
-
},
|
670
|
-
{
|
671
|
-
action: PokerAction.new(PokerAction::CALL, cost: wager_size),
|
672
|
-
round: 2,
|
673
|
-
acting_player_position: 1
|
674
|
-
},
|
675
|
-
{
|
676
|
-
action: PokerAction.new(PokerAction::CHECK),
|
677
|
-
round: 3,
|
678
|
-
acting_player_position: 1
|
679
|
-
},
|
680
|
-
{
|
681
|
-
action: PokerAction.new(PokerAction::BET, cost: wager_size),
|
682
|
-
round: 3,
|
683
|
-
acting_player_position: 2
|
684
|
-
},
|
685
|
-
{
|
686
|
-
action: PokerAction.new(PokerAction::CALL, cost: wager_size),
|
687
|
-
round: 3,
|
688
|
-
acting_player_position: 1
|
689
|
-
}
|
690
|
-
]
|
691
660
|
hands = x_game_def.number_of_players.times.map { Hand.new }
|
692
661
|
|
693
662
|
hands[position] = arbitrary_hole_card_hand
|
@@ -704,6 +673,31 @@ describe MatchState do
|
|
704
673
|
)
|
705
674
|
end
|
706
675
|
end
|
676
|
+
it 'works when players are all-in' do
|
677
|
+
wager_size = 10
|
678
|
+
x_game_def = GameDefinition.new(
|
679
|
+
first_player_positions: [3, 2, 2, 2],
|
680
|
+
chip_stacks: [100, 200, 150],
|
681
|
+
blinds: [0, 10, 5],
|
682
|
+
raise_sizes: [wager_size]*4,
|
683
|
+
number_of_ranks: 3
|
684
|
+
)
|
685
|
+
|
686
|
+
(0..x_game_def.number_of_players-1).each do |position|
|
687
|
+
hands = x_game_def.number_of_players.times.map { arbitrary_hole_card_hand }
|
688
|
+
|
689
|
+
hand_string = hands.inject('') do |hand_string, hand|
|
690
|
+
hand_string << "#{hand}#{MatchState::HAND_SEPARATOR}"
|
691
|
+
end[0..-2]
|
692
|
+
|
693
|
+
match_state =
|
694
|
+
"#{MatchState::LABEL}:#{position}:0:cr200cc///:#{hand_string}"
|
695
|
+
|
696
|
+
MatchState.new(match_state).player_acting_sequence(x_game_def).must_equal(
|
697
|
+
[[2, 0, 1, 2], [], [], []]
|
698
|
+
)
|
699
|
+
end
|
700
|
+
end
|
707
701
|
end
|
708
702
|
describe '#hand_ended?' do
|
709
703
|
it 'works when there is a showdown' do
|
@@ -781,6 +775,54 @@ describe MatchState do
|
|
781
775
|
MatchState.new(match_state).hand_ended?(x_game_def).must_equal true
|
782
776
|
end
|
783
777
|
end
|
778
|
+
it 'works when one player has gone all-in' do
|
779
|
+
wager_size = 10
|
780
|
+
x_game_def = GameDefinition.new(
|
781
|
+
first_player_positions: [3, 2, 2, 2],
|
782
|
+
chip_stacks: [100, 200, 150],
|
783
|
+
blinds: [0, 10, 5],
|
784
|
+
raise_sizes: [wager_size]*4,
|
785
|
+
number_of_ranks: 3
|
786
|
+
)
|
787
|
+
|
788
|
+
(0..x_game_def.number_of_players-1).each do |position|
|
789
|
+
hands = x_game_def.number_of_players.times.map { Hand.new }
|
790
|
+
|
791
|
+
hands[position] = arbitrary_hole_card_hand
|
792
|
+
|
793
|
+
hand_string = hands.inject('') do |hand_string, hand|
|
794
|
+
hand_string << "#{hand}#{MatchState::HAND_SEPARATOR}"
|
795
|
+
end[0..-2]
|
796
|
+
|
797
|
+
match_state =
|
798
|
+
"#{MatchState::LABEL}:#{position}:0:cr200:#{hand_string}"
|
799
|
+
|
800
|
+
MatchState.new(match_state).hand_ended?(x_game_def).must_equal false
|
801
|
+
end
|
802
|
+
end
|
803
|
+
it 'works when all players have gone all-in' do
|
804
|
+
wager_size = 10
|
805
|
+
x_game_def = GameDefinition.new(
|
806
|
+
first_player_positions: [3, 2, 2, 2],
|
807
|
+
chip_stacks: [100, 200, 150],
|
808
|
+
blinds: [0, 10, 5],
|
809
|
+
raise_sizes: [wager_size]*4,
|
810
|
+
number_of_ranks: 3
|
811
|
+
)
|
812
|
+
|
813
|
+
(0..x_game_def.number_of_players-1).each do |position|
|
814
|
+
hands = x_game_def.number_of_players.times.map { arbitrary_hole_card_hand }
|
815
|
+
|
816
|
+
hand_string = hands.inject('') do |hand_string, hand|
|
817
|
+
hand_string << "#{hand}#{MatchState::HAND_SEPARATOR}"
|
818
|
+
end[0..-2]
|
819
|
+
|
820
|
+
match_state =
|
821
|
+
"#{MatchState::LABEL}:#{position}:0:cr200cc///:#{hand_string}"
|
822
|
+
|
823
|
+
MatchState.new(match_state).hand_ended?(x_game_def).must_equal true
|
824
|
+
end
|
825
|
+
end
|
784
826
|
end
|
785
827
|
describe '#min_wager_by' do
|
786
828
|
it 'return proper player states' do
|
data/spec/player_spec.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require_relative 'support/spec_helper'
|
2
|
+
|
3
|
+
require 'acpc_poker_types/player'
|
4
|
+
|
5
|
+
include AcpcPokerTypes
|
6
|
+
|
7
|
+
describe Player do
|
8
|
+
describe '::new' do
|
9
|
+
it 'works' do
|
10
|
+
x_seat = 1
|
11
|
+
|
12
|
+
patient = Player.new x_seat
|
13
|
+
|
14
|
+
patient.seat.must_equal x_seat
|
15
|
+
patient.balance.must_equal 0
|
16
|
+
patient.hand_player.must_be_kind_of NilHandPlayer
|
17
|
+
patient.stack.must_equal 0
|
18
|
+
patient.contributions.must_equal []
|
19
|
+
patient.total_contribution.must_equal 0
|
20
|
+
patient.legal_actions.must_equal []
|
21
|
+
patient.inactive?.must_equal false
|
22
|
+
patient.all_in?.must_equal false
|
23
|
+
patient.folded?.must_equal false
|
24
|
+
patient.initial_stack.must_equal 0
|
25
|
+
patient.ante.must_equal 0
|
26
|
+
patient.hand.must_equal Hand.new
|
27
|
+
patient.actions.must_equal [[]]
|
28
|
+
patient.winnings.must_equal 0
|
29
|
+
end
|
30
|
+
end
|
31
|
+
describe '#hand_player=' do
|
32
|
+
it "gives player all of the HandPlayer's methods" do
|
33
|
+
x_seat = 1
|
34
|
+
|
35
|
+
patient = Player.new x_seat
|
36
|
+
|
37
|
+
x_hand_player = HandPlayer.new(Hand.from_acpc('AhKs'), 100, 2)
|
38
|
+
patient.hand_player = x_hand_player
|
39
|
+
|
40
|
+
patient.seat.must_equal x_seat
|
41
|
+
patient.balance.must_equal 0
|
42
|
+
patient.hand_player.must_equal x_hand_player
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,133 @@
|
|
1
|
+
|
2
|
+
require_relative 'support/spec_helper'
|
3
|
+
|
4
|
+
require 'acpc_dealer'
|
5
|
+
require 'acpc_poker_types/poker_action'
|
6
|
+
require 'acpc_poker_types/card'
|
7
|
+
require 'acpc_poker_types/players_at_the_table'
|
8
|
+
require 'acpc_poker_types/dealer_data'
|
9
|
+
|
10
|
+
include AcpcPokerTypes
|
11
|
+
|
12
|
+
describe PlayersAtTheTable do
|
13
|
+
describe '#update!' do
|
14
|
+
it "keeps track of state for a sequence of match states and actions in Doyle's game" do
|
15
|
+
# Change this number to do more or less thorough tests.
|
16
|
+
# Some interesting three player hands occur after 120
|
17
|
+
# Careful though, even 10 hands takes about three seconds,
|
18
|
+
# and it scales slightly less than linearly. 120 takes
|
19
|
+
# about 30 seconds.
|
20
|
+
num_hands = 120
|
21
|
+
MatchLog.all.each do |log_description|
|
22
|
+
@match = DealerData::PokerMatchData.parse_files(
|
23
|
+
log_description.actions_file_path,
|
24
|
+
log_description.results_file_path,
|
25
|
+
log_description.player_names,
|
26
|
+
AcpcDealer::DEALER_DIRECTORY,
|
27
|
+
num_hands
|
28
|
+
)
|
29
|
+
@match.for_every_seat! do |users_seat|
|
30
|
+
|
31
|
+
@patient = PlayersAtTheTable.seat_players(@match.match_def.game_def, users_seat)
|
32
|
+
|
33
|
+
check_patient
|
34
|
+
|
35
|
+
@match.for_every_hand! do
|
36
|
+
@match.for_every_turn! do
|
37
|
+
@patient.update! @match.current_hand.current_match_state
|
38
|
+
check_patient
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def check_patient(patient=@patient)
|
47
|
+
patient.player_acting_sequence.must_equal @match.player_acting_sequence
|
48
|
+
patient.players.length.must_equal @match.players.length
|
49
|
+
check_next_to_act
|
50
|
+
check_last_turn
|
51
|
+
patient.player_acting_sequence_string.must_equal @match.player_acting_sequence_string
|
52
|
+
patient.users_turn_to_act?.must_equal @match.users_turn_to_act?
|
53
|
+
check_betting_sequence(patient)
|
54
|
+
|
55
|
+
if @match.current_hand
|
56
|
+
patient.hand_ended?.must_equal @match.current_hand.final_turn?
|
57
|
+
unless @match.current_hand.final_turn?
|
58
|
+
patient.match_state.all_hands.each do |hand|
|
59
|
+
hand.each do |card|
|
60
|
+
card.must_be_kind_of AcpcPokerTypes::Card
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
# @todo Test this eventually
|
66
|
+
# patient.min_wager.to_i.must_equal @min_wager.to_i
|
67
|
+
end
|
68
|
+
|
69
|
+
def check_player_blind_relation(patient)
|
70
|
+
patient.position_relative_to_dealer(patient.big_blind_payer).must_equal(
|
71
|
+
@match.match_def.game_def.blinds.index(@match.match_def.game_def.blinds.max)
|
72
|
+
)
|
73
|
+
patient.position_relative_to_dealer(patient.small_blind_payer).must_equal(
|
74
|
+
@match.match_def.game_def.blinds.index do |blind|
|
75
|
+
blind < @match.match_def.game_def.blinds.max && blind > 0
|
76
|
+
end
|
77
|
+
)
|
78
|
+
end
|
79
|
+
def check_betting_sequence(patient)
|
80
|
+
x_betting_sequence = @match.betting_sequence.map do |actions|
|
81
|
+
actions.map { |action| AcpcPokerTypes::PokerAction.new(action).to_s }
|
82
|
+
end
|
83
|
+
|
84
|
+
return x_betting_sequence.flatten.empty?.must_equal(true) unless patient.match_state
|
85
|
+
|
86
|
+
patient.match_state.betting_sequence.map do |actions|
|
87
|
+
actions.map { |action| AcpcPokerTypes::PokerAction.new(action).to_s }
|
88
|
+
end.must_equal x_betting_sequence
|
89
|
+
|
90
|
+
patient.match_state.betting_sequence_string.scan(/([a-z]\d*|\/)/).flatten.map do |action|
|
91
|
+
if action.match(/\//)
|
92
|
+
action
|
93
|
+
else
|
94
|
+
AcpcPokerTypes::PokerAction.new(action).to_s
|
95
|
+
end
|
96
|
+
end.join('').must_equal @match.betting_sequence_string
|
97
|
+
end
|
98
|
+
def check_next_to_act(patient=@patient)
|
99
|
+
if @match.current_hand && @match.current_hand.next_action
|
100
|
+
patient.next_player_to_act.seat.must_equal @match.current_hand.next_action.seat
|
101
|
+
else
|
102
|
+
patient.next_player_to_act.seat.must_be_nil
|
103
|
+
end
|
104
|
+
end
|
105
|
+
def check_last_turn(patient=@patient)
|
106
|
+
return unless @match.current_hand && @match.current_hand.final_turn?
|
107
|
+
|
108
|
+
patient.players.players_close_enough?(@match.players).must_equal true
|
109
|
+
check_player_blind_relation(patient)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
class Array
|
114
|
+
def players_close_enough?(other_players)
|
115
|
+
return false if other_players.length != length
|
116
|
+
each_with_index do |player, index|
|
117
|
+
return false unless player.close_enough?(other_players[index])
|
118
|
+
end
|
119
|
+
true
|
120
|
+
end
|
121
|
+
def reject_empty_elements
|
122
|
+
reject do |elem|
|
123
|
+
elem.empty?
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
class Player
|
129
|
+
def close_enough?(other)
|
130
|
+
@seat == other.seat &&
|
131
|
+
balance == other.balance
|
132
|
+
end
|
133
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acpc_poker_types
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 7.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dustin Morrill
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: process_runner
|
@@ -158,99 +158,62 @@ executables: []
|
|
158
158
|
extensions: []
|
159
159
|
extra_rdoc_files: []
|
160
160
|
files:
|
161
|
-
- lib/acpc_poker_types
|
162
|
-
- lib/acpc_poker_types/match_state.rb
|
163
|
-
- lib/acpc_poker_types/hand.rb
|
164
|
-
- lib/acpc_poker_types/acpc_dealer_data.rb
|
165
|
-
- lib/acpc_poker_types/hand_player.rb
|
166
|
-
- lib/acpc_poker_types/rank.rb
|
167
|
-
- lib/acpc_poker_types/card.rb
|
161
|
+
- lib/acpc_poker_types.rb
|
168
162
|
- lib/acpc_poker_types/seat.rb
|
169
|
-
- lib/acpc_poker_types/
|
170
|
-
- lib/acpc_poker_types/
|
171
|
-
- lib/acpc_poker_types/
|
172
|
-
- lib/acpc_poker_types/
|
173
|
-
- lib/acpc_poker_types/
|
174
|
-
- lib/acpc_poker_types/
|
163
|
+
- lib/acpc_poker_types/board_cards.rb
|
164
|
+
- lib/acpc_poker_types/player.rb
|
165
|
+
- lib/acpc_poker_types/dealer_data/action_messages.rb
|
166
|
+
- lib/acpc_poker_types/dealer_data/log_file.rb
|
167
|
+
- lib/acpc_poker_types/dealer_data/match_definition.rb
|
168
|
+
- lib/acpc_poker_types/dealer_data/hand_results.rb
|
169
|
+
- lib/acpc_poker_types/dealer_data/hand_data.rb
|
170
|
+
- lib/acpc_poker_types/dealer_data/poker_match_data.rb
|
171
|
+
- lib/acpc_poker_types/dealer_data.rb
|
175
172
|
- lib/acpc_poker_types/poker_action.rb
|
176
|
-
- lib/acpc_poker_types/game_definition.rb
|
177
|
-
- lib/acpc_poker_types/player_group.rb
|
178
|
-
- lib/acpc_poker_types/suit.rb
|
179
173
|
- lib/acpc_poker_types/chip_stack.rb
|
180
|
-
- lib/acpc_poker_types/
|
174
|
+
- lib/acpc_poker_types/hand_player_group.rb
|
175
|
+
- lib/acpc_poker_types/game_definition.rb
|
176
|
+
- lib/acpc_poker_types/pile_of_cards.rb
|
177
|
+
- lib/acpc_poker_types/card.rb
|
181
178
|
- lib/acpc_poker_types/version.rb
|
182
|
-
- lib/acpc_poker_types.rb
|
179
|
+
- lib/acpc_poker_types/hand.rb
|
180
|
+
- lib/acpc_poker_types/rank.rb
|
181
|
+
- lib/acpc_poker_types/suit.rb
|
182
|
+
- lib/acpc_poker_types/players_at_the_table.rb
|
183
|
+
- lib/acpc_poker_types/match_state.rb
|
184
|
+
- lib/acpc_poker_types/hand_player.rb
|
183
185
|
- Rakefile
|
184
186
|
- acpc_poker_types.gemspec
|
185
187
|
- README.md
|
186
|
-
- spec/
|
187
|
-
- spec/
|
188
|
-
- spec/
|
188
|
+
- spec/seat_spec.rb
|
189
|
+
- spec/card_spec.rb
|
190
|
+
- spec/dealer_data/poker_match_data_spec.rb
|
191
|
+
- spec/dealer_data/match_definition_spec.rb
|
192
|
+
- spec/dealer_data/action_messages_spec.rb
|
193
|
+
- spec/dealer_data/hand_data_spec.rb
|
194
|
+
- spec/dealer_data/hand_results_spec.rb
|
195
|
+
- spec/suit_spec.rb
|
196
|
+
- spec/match_state_spec.rb
|
197
|
+
- spec/players_at_the_table_spec.rb
|
198
|
+
- spec/board_cards_spec.rb
|
199
|
+
- spec/hand_player_group_spec.rb
|
200
|
+
- spec/player_spec.rb
|
201
|
+
- spec/hand_spec.rb
|
189
202
|
- spec/game_definition_spec.rb
|
203
|
+
- spec/chip_stack_spec.rb
|
190
204
|
- spec/rank_spec.rb
|
191
205
|
- spec/support/spec_helper.rb
|
192
|
-
- spec/support/dealer_logs/
|
206
|
+
- spec/support/dealer_logs/3p.limit.h1000.r0.log
|
193
207
|
- spec/support/dealer_logs/2p.nolimit.h1000.r0.log
|
194
208
|
- spec/support/dealer_logs/2p.nolimit.h1000.r0.actions.log
|
195
209
|
- spec/support/dealer_logs/3p.nolimit.h1000.r0.log
|
196
|
-
- spec/support/dealer_logs/3p.limit.h1000.r0.log
|
197
210
|
- spec/support/dealer_logs/2p.limit.h1000.r0.log
|
198
211
|
- spec/support/dealer_logs/3p.nolimit.h1000.r0.actions.log
|
199
212
|
- spec/support/dealer_logs/3p.limit.h1000.r0.actions.log
|
200
|
-
- spec/
|
201
|
-
- spec/poker_action_spec.rb
|
202
|
-
- spec/player_group_spec.rb
|
203
|
-
- spec/chip_stack_spec.rb
|
204
|
-
- spec/action_messages_spec.rb
|
213
|
+
- spec/support/dealer_logs/2p.limit.h1000.r0.actions.log
|
205
214
|
- spec/pile_of_cards_spec.rb
|
206
|
-
- spec/
|
207
|
-
- spec/
|
208
|
-
- spec/hand_spec.rb
|
209
|
-
- spec/seat_spec.rb
|
210
|
-
- spec/poker_match_data_spec.rb
|
211
|
-
- spec/coverage/index.html
|
212
|
-
- spec/coverage/assets/0.7.1/application.js
|
213
|
-
- spec/coverage/assets/0.7.1/application.css
|
214
|
-
- spec/coverage/assets/0.7.1/smoothness/images/ui-icons_454545_256x240.png
|
215
|
-
- spec/coverage/assets/0.7.1/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
|
216
|
-
- spec/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_65_ffffff_1x400.png
|
217
|
-
- spec/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_75_dadada_1x400.png
|
218
|
-
- spec/coverage/assets/0.7.1/smoothness/images/ui-icons_cd0a0a_256x240.png
|
219
|
-
- spec/coverage/assets/0.7.1/smoothness/images/ui-bg_flat_75_ffffff_40x100.png
|
220
|
-
- spec/coverage/assets/0.7.1/smoothness/images/ui-icons_888888_256x240.png
|
221
|
-
- spec/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
|
222
|
-
- spec/coverage/assets/0.7.1/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
|
223
|
-
- spec/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
|
224
|
-
- spec/coverage/assets/0.7.1/smoothness/images/ui-icons_2e83ff_256x240.png
|
225
|
-
- spec/coverage/assets/0.7.1/smoothness/images/ui-icons_222222_256x240.png
|
226
|
-
- spec/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
|
227
|
-
- spec/coverage/assets/0.7.1/magnify.png
|
228
|
-
- spec/coverage/assets/0.7.1/favicon_red.png
|
229
|
-
- spec/coverage/assets/0.7.1/loading.gif
|
230
|
-
- spec/coverage/assets/0.7.1/favicon_green.png
|
231
|
-
- spec/coverage/assets/0.7.1/fancybox/fancy_close.png
|
232
|
-
- spec/coverage/assets/0.7.1/fancybox/fancy_title_left.png
|
233
|
-
- spec/coverage/assets/0.7.1/fancybox/fancy_shadow_e.png
|
234
|
-
- spec/coverage/assets/0.7.1/fancybox/fancy_nav_left.png
|
235
|
-
- spec/coverage/assets/0.7.1/fancybox/fancy_title_right.png
|
236
|
-
- spec/coverage/assets/0.7.1/fancybox/fancybox-x.png
|
237
|
-
- spec/coverage/assets/0.7.1/fancybox/fancybox.png
|
238
|
-
- spec/coverage/assets/0.7.1/fancybox/fancy_shadow_w.png
|
239
|
-
- spec/coverage/assets/0.7.1/fancybox/blank.gif
|
240
|
-
- spec/coverage/assets/0.7.1/fancybox/fancybox-y.png
|
241
|
-
- spec/coverage/assets/0.7.1/fancybox/fancy_shadow_s.png
|
242
|
-
- spec/coverage/assets/0.7.1/fancybox/fancy_title_main.png
|
243
|
-
- spec/coverage/assets/0.7.1/fancybox/fancy_shadow_n.png
|
244
|
-
- spec/coverage/assets/0.7.1/fancybox/fancy_shadow_sw.png
|
245
|
-
- spec/coverage/assets/0.7.1/fancybox/fancy_shadow_ne.png
|
246
|
-
- spec/coverage/assets/0.7.1/fancybox/fancy_shadow_se.png
|
247
|
-
- spec/coverage/assets/0.7.1/fancybox/fancy_shadow_nw.png
|
248
|
-
- spec/coverage/assets/0.7.1/fancybox/fancy_title_over.png
|
249
|
-
- spec/coverage/assets/0.7.1/fancybox/fancy_nav_right.png
|
250
|
-
- spec/coverage/assets/0.7.1/fancybox/fancy_loading.png
|
251
|
-
- spec/coverage/assets/0.7.1/favicon_yellow.png
|
252
|
-
- spec/card_spec.rb
|
253
|
-
- spec/board_cards_spec.rb
|
215
|
+
- spec/poker_action_spec.rb
|
216
|
+
- spec/hand_player_spec.rb
|
254
217
|
homepage: https://github.com/dmorrill10/acpc_poker_types
|
255
218
|
licenses:
|
256
219
|
- MIT
|
@@ -276,72 +239,33 @@ signing_key:
|
|
276
239
|
specification_version: 4
|
277
240
|
summary: ACPC Poker Types
|
278
241
|
test_files:
|
279
|
-
- spec/
|
280
|
-
- spec/
|
281
|
-
- spec/
|
242
|
+
- spec/seat_spec.rb
|
243
|
+
- spec/card_spec.rb
|
244
|
+
- spec/dealer_data/poker_match_data_spec.rb
|
245
|
+
- spec/dealer_data/match_definition_spec.rb
|
246
|
+
- spec/dealer_data/action_messages_spec.rb
|
247
|
+
- spec/dealer_data/hand_data_spec.rb
|
248
|
+
- spec/dealer_data/hand_results_spec.rb
|
249
|
+
- spec/suit_spec.rb
|
250
|
+
- spec/match_state_spec.rb
|
251
|
+
- spec/players_at_the_table_spec.rb
|
252
|
+
- spec/board_cards_spec.rb
|
253
|
+
- spec/hand_player_group_spec.rb
|
254
|
+
- spec/player_spec.rb
|
255
|
+
- spec/hand_spec.rb
|
282
256
|
- spec/game_definition_spec.rb
|
257
|
+
- spec/chip_stack_spec.rb
|
283
258
|
- spec/rank_spec.rb
|
284
259
|
- spec/support/spec_helper.rb
|
285
|
-
- spec/support/dealer_logs/
|
260
|
+
- spec/support/dealer_logs/3p.limit.h1000.r0.log
|
286
261
|
- spec/support/dealer_logs/2p.nolimit.h1000.r0.log
|
287
262
|
- spec/support/dealer_logs/2p.nolimit.h1000.r0.actions.log
|
288
263
|
- spec/support/dealer_logs/3p.nolimit.h1000.r0.log
|
289
|
-
- spec/support/dealer_logs/3p.limit.h1000.r0.log
|
290
264
|
- spec/support/dealer_logs/2p.limit.h1000.r0.log
|
291
265
|
- spec/support/dealer_logs/3p.nolimit.h1000.r0.actions.log
|
292
266
|
- spec/support/dealer_logs/3p.limit.h1000.r0.actions.log
|
293
|
-
- spec/
|
294
|
-
- spec/poker_action_spec.rb
|
295
|
-
- spec/player_group_spec.rb
|
296
|
-
- spec/chip_stack_spec.rb
|
297
|
-
- spec/action_messages_spec.rb
|
267
|
+
- spec/support/dealer_logs/2p.limit.h1000.r0.actions.log
|
298
268
|
- spec/pile_of_cards_spec.rb
|
299
|
-
- spec/
|
300
|
-
- spec/
|
301
|
-
- spec/hand_spec.rb
|
302
|
-
- spec/seat_spec.rb
|
303
|
-
- spec/poker_match_data_spec.rb
|
304
|
-
- spec/coverage/index.html
|
305
|
-
- spec/coverage/assets/0.7.1/application.js
|
306
|
-
- spec/coverage/assets/0.7.1/application.css
|
307
|
-
- spec/coverage/assets/0.7.1/smoothness/images/ui-icons_454545_256x240.png
|
308
|
-
- spec/coverage/assets/0.7.1/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
|
309
|
-
- spec/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_65_ffffff_1x400.png
|
310
|
-
- spec/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_75_dadada_1x400.png
|
311
|
-
- spec/coverage/assets/0.7.1/smoothness/images/ui-icons_cd0a0a_256x240.png
|
312
|
-
- spec/coverage/assets/0.7.1/smoothness/images/ui-bg_flat_75_ffffff_40x100.png
|
313
|
-
- spec/coverage/assets/0.7.1/smoothness/images/ui-icons_888888_256x240.png
|
314
|
-
- spec/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
|
315
|
-
- spec/coverage/assets/0.7.1/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
|
316
|
-
- spec/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
|
317
|
-
- spec/coverage/assets/0.7.1/smoothness/images/ui-icons_2e83ff_256x240.png
|
318
|
-
- spec/coverage/assets/0.7.1/smoothness/images/ui-icons_222222_256x240.png
|
319
|
-
- spec/coverage/assets/0.7.1/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
|
320
|
-
- spec/coverage/assets/0.7.1/magnify.png
|
321
|
-
- spec/coverage/assets/0.7.1/favicon_red.png
|
322
|
-
- spec/coverage/assets/0.7.1/loading.gif
|
323
|
-
- spec/coverage/assets/0.7.1/favicon_green.png
|
324
|
-
- spec/coverage/assets/0.7.1/fancybox/fancy_close.png
|
325
|
-
- spec/coverage/assets/0.7.1/fancybox/fancy_title_left.png
|
326
|
-
- spec/coverage/assets/0.7.1/fancybox/fancy_shadow_e.png
|
327
|
-
- spec/coverage/assets/0.7.1/fancybox/fancy_nav_left.png
|
328
|
-
- spec/coverage/assets/0.7.1/fancybox/fancy_title_right.png
|
329
|
-
- spec/coverage/assets/0.7.1/fancybox/fancybox-x.png
|
330
|
-
- spec/coverage/assets/0.7.1/fancybox/fancybox.png
|
331
|
-
- spec/coverage/assets/0.7.1/fancybox/fancy_shadow_w.png
|
332
|
-
- spec/coverage/assets/0.7.1/fancybox/blank.gif
|
333
|
-
- spec/coverage/assets/0.7.1/fancybox/fancybox-y.png
|
334
|
-
- spec/coverage/assets/0.7.1/fancybox/fancy_shadow_s.png
|
335
|
-
- spec/coverage/assets/0.7.1/fancybox/fancy_title_main.png
|
336
|
-
- spec/coverage/assets/0.7.1/fancybox/fancy_shadow_n.png
|
337
|
-
- spec/coverage/assets/0.7.1/fancybox/fancy_shadow_sw.png
|
338
|
-
- spec/coverage/assets/0.7.1/fancybox/fancy_shadow_ne.png
|
339
|
-
- spec/coverage/assets/0.7.1/fancybox/fancy_shadow_se.png
|
340
|
-
- spec/coverage/assets/0.7.1/fancybox/fancy_shadow_nw.png
|
341
|
-
- spec/coverage/assets/0.7.1/fancybox/fancy_title_over.png
|
342
|
-
- spec/coverage/assets/0.7.1/fancybox/fancy_nav_right.png
|
343
|
-
- spec/coverage/assets/0.7.1/fancybox/fancy_loading.png
|
344
|
-
- spec/coverage/assets/0.7.1/favicon_yellow.png
|
345
|
-
- spec/card_spec.rb
|
346
|
-
- spec/board_cards_spec.rb
|
269
|
+
- spec/poker_action_spec.rb
|
270
|
+
- spec/hand_player_spec.rb
|
347
271
|
has_rdoc:
|