acpc_poker_types 0.0.10 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +7 -4
- data/acpc_poker_types.gemspec +4 -2
- data/lib/acpc_poker_types.rb +13 -12
- data/lib/acpc_poker_types/acpc_dealer_data.rb +9 -0
- data/lib/acpc_poker_types/acpc_dealer_data/action_messages.rb +133 -0
- data/lib/acpc_poker_types/acpc_dealer_data/hand_data.rb +182 -0
- data/lib/acpc_poker_types/acpc_dealer_data/hand_results.rb +79 -0
- data/lib/acpc_poker_types/acpc_dealer_data/log_file.rb +5 -0
- data/lib/acpc_poker_types/acpc_dealer_data/match_definition.rb +54 -0
- data/lib/acpc_poker_types/acpc_dealer_data/poker_match_data.rb +393 -0
- data/lib/acpc_poker_types/board_cards.rb +4 -4
- data/lib/acpc_poker_types/card.rb +16 -16
- data/lib/acpc_poker_types/chip_stack.rb +1 -1
- data/lib/acpc_poker_types/game_definition.rb +34 -38
- data/lib/acpc_poker_types/hand.rb +5 -5
- data/lib/acpc_poker_types/match_state.rb +31 -32
- data/lib/acpc_poker_types/pile_of_cards.rb +1 -1
- data/lib/acpc_poker_types/player.rb +16 -15
- data/lib/acpc_poker_types/poker_action.rb +6 -6
- data/lib/acpc_poker_types/rank.rb +2 -2
- data/lib/acpc_poker_types/suit.rb +4 -4
- data/lib/acpc_poker_types/version.rb +1 -1
- data/spec/action_messages_spec.rb +450 -0
- data/spec/board_cards_spec.rb +9 -9
- data/spec/card_spec.rb +20 -20
- data/spec/chip_stack_spec.rb +28 -29
- data/spec/game_definition_spec.rb +11 -11
- data/spec/hand_data_spec.rb +295 -0
- data/spec/hand_results_spec.rb +292 -0
- data/spec/hand_spec.rb +11 -11
- data/spec/match_definition_spec.rb +95 -0
- data/spec/match_state_spec.rb +105 -287
- data/spec/pile_of_cards_spec.rb +14 -14
- data/spec/player_spec.rb +61 -61
- data/spec/poker_action_spec.rb +49 -49
- data/spec/poker_match_data_spec.rb +388 -0
- data/spec/rank_spec.rb +19 -19
- data/spec/suit_spec.rb +19 -19
- data/spec/support/spec_helper.rb +28 -6
- metadata +55 -10
data/spec/board_cards_spec.rb
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
# Spec helper (must include first to track code coverage with SimpleCov)
|
3
3
|
require File.expand_path('../support/spec_helper', __FILE__)
|
4
4
|
|
5
|
-
require "
|
5
|
+
require "acpc_poker_types/card"
|
6
6
|
|
7
|
-
require
|
7
|
+
require 'acpc_poker_types/board_cards'
|
8
8
|
|
9
|
-
describe BoardCards do
|
9
|
+
describe AcpcPokerTypes::BoardCards do
|
10
10
|
describe '#to_s' do
|
11
11
|
it 'prints itself properly' do
|
12
|
-
@patient = BoardCards.new
|
12
|
+
@patient = AcpcPokerTypes::BoardCards.new
|
13
13
|
|
14
14
|
@string = ''
|
15
|
-
|
15
|
+
|
16
16
|
check_patient
|
17
17
|
|
18
18
|
for_many_rounds do |round|
|
@@ -28,11 +28,11 @@ describe BoardCards do
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
def check_patient() @patient.to_s.
|
31
|
+
def check_patient() @patient.to_s.must_equal @string end
|
32
32
|
def for_every_card
|
33
|
-
Rank::DOMAIN.map do |rank, rank_properties|
|
34
|
-
Suit::DOMAIN.map do |suit, suit_properties|
|
35
|
-
yield Card.from_components(rank, suit)
|
33
|
+
AcpcPokerTypes::Rank::DOMAIN.map do |rank, rank_properties|
|
34
|
+
AcpcPokerTypes::Suit::DOMAIN.map do |suit, suit_properties|
|
35
|
+
yield AcpcPokerTypes::Card.from_components(rank, suit)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
data/spec/card_spec.rb
CHANGED
@@ -2,30 +2,30 @@
|
|
2
2
|
# Spec helper (must include first to track code coverage with SimpleCov)
|
3
3
|
require File.expand_path('../support/spec_helper', __FILE__)
|
4
4
|
|
5
|
-
require
|
5
|
+
require 'acpc_poker_types/card'
|
6
6
|
|
7
|
-
describe Card do
|
7
|
+
describe AcpcPokerTypes::Card do
|
8
8
|
describe '::from_acpc' do
|
9
9
|
it 'raises an exception if the given ACPC card string could not be parsed properly' do
|
10
|
-
|
11
|
-
Card.from_acpc('not a card')
|
12
|
-
end.
|
10
|
+
-> do
|
11
|
+
AcpcPokerTypes::Card.from_acpc('not a card')
|
12
|
+
end.must_raise(AcpcPokerTypes::Card::ParseError)
|
13
13
|
end
|
14
14
|
it 'works properly in all cases' do
|
15
15
|
for_every_card! do
|
16
|
-
@patient = Card.from_acpc @acpc
|
16
|
+
@patient = AcpcPokerTypes::Card.from_acpc @acpc
|
17
17
|
|
18
18
|
check_patient
|
19
19
|
|
20
|
-
@patient = Card.from_components @rank, @suit
|
20
|
+
@patient = AcpcPokerTypes::Card.from_components @rank, @suit
|
21
21
|
|
22
22
|
check_patient
|
23
23
|
|
24
|
-
@patient = Card.from_components @rank.to_sym, @suit.to_sym
|
24
|
+
@patient = AcpcPokerTypes::Card.from_components @rank.to_sym, @suit.to_sym
|
25
25
|
|
26
26
|
check_patient
|
27
27
|
|
28
|
-
@patient = Card.from_components @rank.to_s, @suit.to_i
|
28
|
+
@patient = AcpcPokerTypes::Card.from_components @rank.to_s, @suit.to_i
|
29
29
|
|
30
30
|
check_patient
|
31
31
|
end
|
@@ -33,10 +33,10 @@ describe Card do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def for_every_card!
|
36
|
-
Rank::DOMAIN.map do |rank, rank_properties|
|
37
|
-
@rank = Rank.new rank
|
38
|
-
Suit::DOMAIN.map do |suit, suit_properties|
|
39
|
-
@suit = Suit.new suit
|
36
|
+
AcpcPokerTypes::Rank::DOMAIN.map do |rank, rank_properties|
|
37
|
+
@rank = AcpcPokerTypes::Rank.new rank
|
38
|
+
AcpcPokerTypes::Suit::DOMAIN.map do |suit, suit_properties|
|
39
|
+
@suit = AcpcPokerTypes::Suit.new suit
|
40
40
|
@number = acpc_card_number @rank, @suit
|
41
41
|
@string = rank_properties[:text] + suit_properties[:acpc_character]
|
42
42
|
@acpc = rank_properties[:acpc_character] + suit_properties[:acpc_character]
|
@@ -47,15 +47,15 @@ describe Card do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def acpc_card_number(rank, suit)
|
50
|
-
rank.to_i * Suit::DOMAIN.length + suit.to_i
|
50
|
+
rank.to_i * AcpcPokerTypes::Suit::DOMAIN.length + suit.to_i
|
51
51
|
end
|
52
52
|
|
53
53
|
def check_patient
|
54
|
-
@patient.rank.to_sym.
|
55
|
-
@patient.suit.to_sym.
|
56
|
-
@patient.to_i.
|
57
|
-
@patient.to_s.
|
58
|
-
@patient.to_str.
|
59
|
-
@patient.to_acpc.
|
54
|
+
@patient.rank.to_sym.must_equal @rank.to_sym
|
55
|
+
@patient.suit.to_sym.must_equal @suit.to_sym
|
56
|
+
@patient.to_i.must_equal @number
|
57
|
+
@patient.to_s.must_equal @string
|
58
|
+
@patient.to_str.must_equal @string
|
59
|
+
@patient.to_acpc.must_equal @acpc
|
60
60
|
end
|
61
61
|
end
|
data/spec/chip_stack_spec.rb
CHANGED
@@ -2,116 +2,115 @@
|
|
2
2
|
# Spec helper (must include first to track code coverage with SimpleCov)
|
3
3
|
require File.expand_path('../support/spec_helper', __FILE__)
|
4
4
|
|
5
|
-
|
6
|
-
require File.expand_path("#{LIB_ACPC_POKER_TYPES_PATH}/chip_stack", __FILE__)
|
5
|
+
require 'acpc_poker_types/chip_stack'
|
7
6
|
|
8
|
-
describe ChipStack do
|
7
|
+
describe AcpcPokerTypes::ChipStack do
|
9
8
|
describe '#initialization' do
|
10
9
|
describe 'raises an exception if the number of chips to be made into a stack' do
|
11
10
|
it 'is negative' do
|
12
|
-
|
11
|
+
->{AcpcPokerTypes::ChipStack.new(-1)}.must_raise(AcpcPokerTypes::ChipStack::IllegalNumberOfChips)
|
13
12
|
end
|
14
13
|
end
|
15
14
|
end
|
16
15
|
describe '#to_i and #==' do
|
17
16
|
it 'reports the number of chips the stack contains' do
|
18
17
|
number_of_chips = 100
|
19
|
-
patient = ChipStack.new number_of_chips
|
18
|
+
patient = AcpcPokerTypes::ChipStack.new number_of_chips
|
20
19
|
|
21
|
-
patient.to_i.
|
22
|
-
patient.
|
20
|
+
patient.to_i.must_equal number_of_chips
|
21
|
+
patient.must_equal(number_of_chips)
|
23
22
|
end
|
24
23
|
end
|
25
24
|
describe '#receive!' do
|
26
25
|
it 'raises an exception if the number of chips to be added is greater than the number of chips in the stack' do
|
27
|
-
patient = ChipStack.new 100
|
28
|
-
|
26
|
+
patient = AcpcPokerTypes::ChipStack.new 100
|
27
|
+
->{patient.receive!(-101)}.must_raise(AcpcPokerTypes::ChipStack::IllegalNumberOfChips)
|
29
28
|
end
|
30
29
|
it 'adds a number of chips to the stack' do
|
31
30
|
initial_number_of_chips = 100
|
32
|
-
patient = ChipStack.new initial_number_of_chips
|
31
|
+
patient = AcpcPokerTypes::ChipStack.new initial_number_of_chips
|
33
32
|
|
34
33
|
amount_added = 50
|
35
34
|
number_of_chips = initial_number_of_chips + amount_added
|
36
35
|
|
37
|
-
patient.receive!(amount_added).
|
36
|
+
patient.receive!(amount_added).must_equal(number_of_chips)
|
38
37
|
end
|
39
38
|
end
|
40
39
|
describe '#give!' do
|
41
40
|
it 'raises an exception if the number of chips to be taken is greater than the number of chips in the stack' do
|
42
|
-
patient = ChipStack.new 100
|
43
|
-
|
41
|
+
patient = AcpcPokerTypes::ChipStack.new 100
|
42
|
+
->{patient.give! 101}.must_raise(AcpcPokerTypes::ChipStack::IllegalNumberOfChips)
|
44
43
|
end
|
45
44
|
it 'takes a number of chips from the stack' do
|
46
45
|
initial_number_of_chips = 100
|
47
|
-
patient = ChipStack.new initial_number_of_chips
|
46
|
+
patient = AcpcPokerTypes::ChipStack.new initial_number_of_chips
|
48
47
|
|
49
48
|
amount_taken = 50
|
50
49
|
number_of_chips = initial_number_of_chips - amount_taken
|
51
50
|
|
52
|
-
patient.give!(amount_taken).
|
51
|
+
patient.give!(amount_taken).must_equal(number_of_chips)
|
53
52
|
end
|
54
53
|
end
|
55
54
|
describe '#+' do
|
56
55
|
it 'adds a number of chips to the stack' do
|
57
56
|
initial_number_of_chips = 100
|
58
|
-
patient = ChipStack.new initial_number_of_chips
|
57
|
+
patient = AcpcPokerTypes::ChipStack.new initial_number_of_chips
|
59
58
|
|
60
59
|
amount_added = 50
|
61
60
|
number_of_chips = initial_number_of_chips + amount_added
|
62
61
|
|
63
|
-
(patient + amount_added).
|
62
|
+
(patient + amount_added).must_equal(number_of_chips)
|
64
63
|
end
|
65
64
|
end
|
66
65
|
describe '#-' do
|
67
66
|
it 'takes a number of chips from the stack' do
|
68
67
|
initial_number_of_chips = 100
|
69
|
-
patient = ChipStack.new initial_number_of_chips
|
68
|
+
patient = AcpcPokerTypes::ChipStack.new initial_number_of_chips
|
70
69
|
|
71
70
|
amount_taken = 50
|
72
71
|
number_of_chips = initial_number_of_chips - amount_taken
|
73
72
|
|
74
|
-
(patient - amount_taken).
|
73
|
+
(patient - amount_taken).must_equal(number_of_chips)
|
75
74
|
end
|
76
75
|
end
|
77
|
-
describe '#*' do
|
76
|
+
describe '#*' do
|
78
77
|
it 'multiplies the value of the stack' do
|
79
78
|
initial_number_of_chips = 100
|
80
|
-
patient = ChipStack.new initial_number_of_chips
|
79
|
+
patient = AcpcPokerTypes::ChipStack.new initial_number_of_chips
|
81
80
|
|
82
81
|
multiplier = 50
|
83
82
|
number_of_chips = initial_number_of_chips * multiplier
|
84
83
|
|
85
|
-
(patient * multiplier).
|
84
|
+
(patient * multiplier).must_equal(number_of_chips)
|
86
85
|
end
|
87
86
|
end
|
88
|
-
describe '#coerce converts Integers to ChipStacks when in' do
|
87
|
+
describe '#coerce converts Integers to AcpcPokerTypes::ChipStacks when in' do
|
89
88
|
it 'Rational#+' do
|
90
89
|
amount_added = 50
|
91
|
-
patient = ChipStack.new amount_added
|
90
|
+
patient = AcpcPokerTypes::ChipStack.new amount_added
|
92
91
|
|
93
92
|
initial_number_of_chips = 100
|
94
93
|
number_of_chips = initial_number_of_chips + amount_added
|
95
94
|
|
96
|
-
(initial_number_of_chips + patient).
|
95
|
+
(initial_number_of_chips + patient).must_equal(number_of_chips)
|
97
96
|
end
|
98
97
|
it 'Rational#-' do
|
99
98
|
amount_taken = 50
|
100
|
-
patient = ChipStack.new amount_taken
|
99
|
+
patient = AcpcPokerTypes::ChipStack.new amount_taken
|
101
100
|
|
102
101
|
initial_number_of_chips = 100
|
103
102
|
number_of_chips = initial_number_of_chips - amount_taken
|
104
103
|
|
105
|
-
(initial_number_of_chips - patient).
|
104
|
+
(initial_number_of_chips - patient).must_equal(number_of_chips)
|
106
105
|
end
|
107
106
|
it 'Rational#*' do
|
108
107
|
initial_number_of_chips = 100
|
109
|
-
patient = ChipStack.new initial_number_of_chips
|
108
|
+
patient = AcpcPokerTypes::ChipStack.new initial_number_of_chips
|
110
109
|
|
111
110
|
multiplier = 50
|
112
111
|
number_of_chips = multiplier * initial_number_of_chips
|
113
112
|
|
114
|
-
(multiplier * patient).
|
113
|
+
(multiplier * patient).must_equal(number_of_chips)
|
115
114
|
end
|
116
115
|
end
|
117
116
|
end
|
@@ -1,14 +1,14 @@
|
|
1
1
|
|
2
2
|
# Spec helper (must include first to track code coverage with SimpleCov)
|
3
|
-
|
3
|
+
require_relative 'support/spec_helper'
|
4
4
|
|
5
5
|
require 'acpc_dealer'
|
6
6
|
|
7
|
-
require
|
7
|
+
require 'acpc_poker_types/game_definition'
|
8
8
|
|
9
|
-
require
|
9
|
+
require 'acpc_poker_types/chip_stack'
|
10
10
|
|
11
|
-
describe GameDefinition do
|
11
|
+
describe AcpcPokerTypes::GameDefinition do
|
12
12
|
include AcpcDealer
|
13
13
|
|
14
14
|
describe '::default_first_player_positions' do
|
@@ -18,7 +18,7 @@ describe GameDefinition do
|
|
18
18
|
list << 0
|
19
19
|
end
|
20
20
|
|
21
|
-
GameDefinition.default_first_player_positions(number_of_rounds).
|
21
|
+
AcpcPokerTypes::GameDefinition.default_first_player_positions(number_of_rounds).must_equal expected_positions
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -29,7 +29,7 @@ describe GameDefinition do
|
|
29
29
|
list << (2**8 - 1)
|
30
30
|
end
|
31
31
|
|
32
|
-
GameDefinition.default_max_number_of_wagers(number_of_rounds).
|
32
|
+
AcpcPokerTypes::GameDefinition.default_max_number_of_wagers(number_of_rounds).must_equal expected_number_of_wagers
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
@@ -37,10 +37,10 @@ describe GameDefinition do
|
|
37
37
|
it 'works' do
|
38
38
|
100.times do |number_of_players|
|
39
39
|
expected_chip_stacks = number_of_players.times.inject([]) do |list, j|
|
40
|
-
list << ChipStack.new(2**31 - 1)
|
40
|
+
list << AcpcPokerTypes::ChipStack.new(2**31 - 1)
|
41
41
|
end
|
42
42
|
|
43
|
-
GameDefinition.default_chip_stacks(number_of_players).
|
43
|
+
AcpcPokerTypes::GameDefinition.default_chip_stacks(number_of_players).must_equal expected_chip_stacks
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -49,7 +49,7 @@ describe GameDefinition do
|
|
49
49
|
it "parses all available game definitions properly" do
|
50
50
|
AcpcDealer::GAME_DEFINITION_FILE_PATHS.each do |key, groups_of_defs|
|
51
51
|
groups_of_defs.each do |key, game_definition_file_name|
|
52
|
-
@patient = GameDefinition.parse_file game_definition_file_name
|
52
|
+
@patient = AcpcPokerTypes::GameDefinition.parse_file game_definition_file_name
|
53
53
|
|
54
54
|
@expected = File.readlines(game_definition_file_name).map do |line|
|
55
55
|
line.chomp
|
@@ -57,7 +57,7 @@ describe GameDefinition do
|
|
57
57
|
|
58
58
|
check_patient
|
59
59
|
|
60
|
-
@patient = GameDefinition.parse @expected
|
60
|
+
@patient = AcpcPokerTypes::GameDefinition.parse @expected
|
61
61
|
|
62
62
|
check_patient
|
63
63
|
end
|
@@ -66,6 +66,6 @@ describe GameDefinition do
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def check_patient
|
69
|
-
Set.new(@patient.to_a).superset?(Set.new(@expected)).
|
69
|
+
Set.new(@patient.to_a).superset?(Set.new(@expected)).must_equal true
|
70
70
|
end
|
71
71
|
end
|
@@ -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/setup'
|
6
|
+
|
7
|
+
require 'acpc_dealer'
|
8
|
+
require 'acpc_poker_types/match_state'
|
9
|
+
require 'acpc_poker_types/poker_action'
|
10
|
+
|
11
|
+
require 'acpc_poker_types/acpc_dealer_data/action_messages'
|
12
|
+
require 'acpc_poker_types/acpc_dealer_data/hand_data'
|
13
|
+
require 'acpc_poker_types/acpc_dealer_data/hand_results'
|
14
|
+
require 'acpc_poker_types/acpc_dealer_data/match_definition'
|
15
|
+
|
16
|
+
describe AcpcPokerTypes::AcpcDealerData::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 = AcpcPokerTypes::AcpcDealerData::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 AcpcPokerTypes::AcpcDealerData::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 = AcpcPokerTypes::AcpcDealerData::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 = AcpcPokerTypes::AcpcDealerData::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 = AcpcPokerTypes::AcpcDealerData::ActionMessages.parse(
|
102
|
+
data_hash[:action_messages],
|
103
|
+
data_hash[:player_names],
|
104
|
+
AcpcDealer::DEALER_DIRECTORY
|
105
|
+
)
|
106
|
+
@hand_result = AcpcPokerTypes::AcpcDealerData::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
|
+
AcpcPokerTypes::AcpcDealerData::HandData::Turn.new(
|
141
|
+
[
|
142
|
+
AcpcPokerTypes::MatchState.parse('MATCHSTATE:1:999:crc/cc/cc/:|TdQd/As6d6h/7h/4s'),
|
143
|
+
AcpcPokerTypes::MatchState.parse('MATCHSTATE:0:999:crc/cc/cc/:Jc8d|/As6d6h/7h/4s')
|
144
|
+
],
|
145
|
+
AcpcPokerTypes::AcpcDealerData::ActionMessages::FromMessage.new(
|
146
|
+
1,
|
147
|
+
AcpcPokerTypes::MatchState.parse('MATCHSTATE:0:999:crc/cc/cc/:Jc8d|/As6d6h/7h/4s'),
|
148
|
+
AcpcPokerTypes::PokerAction.new('r')
|
149
|
+
)
|
150
|
+
),
|
151
|
+
AcpcPokerTypes::AcpcDealerData::HandData::Turn.new(
|
152
|
+
[
|
153
|
+
AcpcPokerTypes::MatchState.parse('MATCHSTATE:1:999:crc/cc/cc/r:|TdQd/As6d6h/7h/4s'),
|
154
|
+
AcpcPokerTypes::MatchState.parse('MATCHSTATE:0:999:crc/cc/cc/r:Jc8d|/As6d6h/7h/4s')
|
155
|
+
],
|
156
|
+
AcpcPokerTypes::AcpcDealerData::ActionMessages::FromMessage.new(
|
157
|
+
0,
|
158
|
+
AcpcPokerTypes::MatchState.parse('MATCHSTATE:1:999:crc/cc/cc/r:|TdQd/As6d6h/7h/4s'),
|
159
|
+
AcpcPokerTypes::PokerAction.new('c')
|
160
|
+
)
|
161
|
+
),
|
162
|
+
AcpcPokerTypes::AcpcDealerData::HandData::Turn.new(
|
163
|
+
[
|
164
|
+
AcpcPokerTypes::MatchState.parse('MATCHSTATE:1:999:crc/cc/cc/rc:Jc8d|TdQd/As6d6h/7h/4s'),
|
165
|
+
AcpcPokerTypes::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
|
+
AcpcPokerTypes::AcpcDealerData::HandData::Turn.new(
|
190
|
+
[
|
191
|
+
AcpcPokerTypes::MatchState.parse('MATCHSTATE:1:999::|TdQd'),
|
192
|
+
AcpcPokerTypes::MatchState.parse('MATCHSTATE:0:999::Jc8d|')
|
193
|
+
],
|
194
|
+
AcpcPokerTypes::AcpcDealerData::ActionMessages::FromMessage.new(
|
195
|
+
0,
|
196
|
+
AcpcPokerTypes::MatchState.parse('MATCHSTATE:1:999::|TdQd'),
|
197
|
+
AcpcPokerTypes::PokerAction.new('f')
|
198
|
+
)
|
199
|
+
),
|
200
|
+
AcpcPokerTypes::AcpcDealerData::HandData::Turn.new(
|
201
|
+
[
|
202
|
+
AcpcPokerTypes::MatchState.parse('MATCHSTATE:1:999:f:|TdQd'),
|
203
|
+
AcpcPokerTypes::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
|
+
AcpcPokerTypes::AcpcDealerData::HandData::Turn.new(
|
230
|
+
[
|
231
|
+
AcpcPokerTypes::MatchState.parse('MATCHSTATE:0:999:ccc/ccc/rrcc/rrrfr:QsAs||/4d6d2d/5d/2c'),
|
232
|
+
AcpcPokerTypes::MatchState.parse('MATCHSTATE:1:999:ccc/ccc/rrcc/rrrfr:|3s8h|/4d6d2d/5d/2c'),
|
233
|
+
AcpcPokerTypes::MatchState.parse('MATCHSTATE:2:999:ccc/ccc/rrcc/rrrfr:||Qd3c/4d6d2d/5d/2c')
|
234
|
+
],
|
235
|
+
AcpcPokerTypes::AcpcDealerData::ActionMessages::FromMessage.new(
|
236
|
+
2,
|
237
|
+
AcpcPokerTypes::MatchState.parse('MATCHSTATE:2:999:ccc/ccc/rrcc/rrrfr:||Qd3c/4d6d2d/5d/2c'),
|
238
|
+
AcpcPokerTypes::PokerAction.new('c')
|
239
|
+
)
|
240
|
+
),
|
241
|
+
AcpcPokerTypes::AcpcDealerData::HandData::Turn.new(
|
242
|
+
[
|
243
|
+
AcpcPokerTypes::MatchState.parse('MATCHSTATE:0:999:ccc/ccc/rrcc/rrrfrc:QsAs|3s8h|Qd3c/4d6d2d/5d/2c'),
|
244
|
+
AcpcPokerTypes::MatchState.parse('MATCHSTATE:1:999:ccc/ccc/rrcc/rrrfrc:|3s8h|Qd3c/4d6d2d/5d/2c'),
|
245
|
+
AcpcPokerTypes::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
|
+
AcpcPokerTypes::AcpcDealerData::HandData::Turn.new(
|
272
|
+
[
|
273
|
+
AcpcPokerTypes::MatchState.parse('MATCHSTATE:0:999:ccr12926r20000c:QsAs||'),
|
274
|
+
AcpcPokerTypes::MatchState.parse('MATCHSTATE:1:999:ccr12926r20000c:|3s8h|'),
|
275
|
+
AcpcPokerTypes::MatchState.parse('MATCHSTATE:2:999:ccr12926r20000c:||Qd3c')
|
276
|
+
],
|
277
|
+
AcpcPokerTypes::AcpcDealerData::ActionMessages::FromMessage.new(
|
278
|
+
1,
|
279
|
+
AcpcPokerTypes::MatchState.parse('MATCHSTATE:1:999:ccr12926r20000c:|3s8h|'),
|
280
|
+
AcpcPokerTypes::PokerAction.new('c')
|
281
|
+
)
|
282
|
+
),
|
283
|
+
AcpcPokerTypes::AcpcDealerData::HandData::Turn.new(
|
284
|
+
[
|
285
|
+
AcpcPokerTypes::MatchState.parse('MATCHSTATE:0:999:ccr12926r20000cc///:QsAs|3s8h|Qd3c/4d6d2d/5d/2c'),
|
286
|
+
AcpcPokerTypes::MatchState.parse('MATCHSTATE:1:999:ccr12926r20000cc///:QsAs|3s8h|Qd3c/4d6d2d/5d/2c'),
|
287
|
+
AcpcPokerTypes::MatchState.parse('MATCHSTATE:2:999:ccr12926r20000cc///:QsAs|3s8h|Qd3c/4d6d2d/5d/2c')
|
288
|
+
],
|
289
|
+
nil
|
290
|
+
)
|
291
|
+
]
|
292
|
+
}
|
293
|
+
}
|
294
|
+
end
|
295
|
+
end
|