acpc_poker_types 2.0.0 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/acpc_poker_types.gemspec +2 -2
- data/lib/acpc_poker_types/acpc_dealer_data/action_messages.rb +1 -3
- data/lib/acpc_poker_types/acpc_dealer_data/poker_match_data.rb +1 -1
- data/lib/acpc_poker_types/board_cards.rb +38 -37
- data/lib/acpc_poker_types/card.rb +40 -54
- data/lib/acpc_poker_types/chip_stack.rb +25 -25
- data/lib/acpc_poker_types/game_definition.rb +286 -284
- data/lib/acpc_poker_types/hand.rb +19 -17
- data/lib/acpc_poker_types/match_state.rb +208 -235
- data/lib/acpc_poker_types/pile_of_cards.rb +6 -4
- data/lib/acpc_poker_types/player.rb +138 -133
- data/lib/acpc_poker_types/poker_action.rb +80 -90
- data/lib/acpc_poker_types/rank.rb +51 -49
- data/lib/acpc_poker_types/suit.rb +45 -43
- data/lib/acpc_poker_types/version.rb +1 -1
- data/spec/card_spec.rb +0 -5
- data/spec/coverage/index.html +1 -1
- data/spec/match_state_spec.rb +8 -10
- data/spec/player_spec.rb +12 -19
- data/spec/poker_action_spec.rb +105 -171
- data/spec/support/spec_helper.rb +0 -1
- metadata +121 -219
- data/spec/coverage/assets/0.5.3/app.js +0 -88
- data/spec/coverage/assets/0.5.3/fancybox/blank.gif +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_close.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_loading.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_nav_left.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_nav_right.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_shadow_e.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_shadow_n.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_shadow_ne.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_shadow_nw.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_shadow_s.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_shadow_se.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_shadow_sw.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_shadow_w.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_title_left.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_title_main.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_title_over.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancy_title_right.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancybox-x.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancybox-y.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/fancybox.png +0 -0
- data/spec/coverage/assets/0.5.3/fancybox/jquery.fancybox-1.3.1.css +0 -363
- data/spec/coverage/assets/0.5.3/fancybox/jquery.fancybox-1.3.1.pack.js +0 -44
- data/spec/coverage/assets/0.5.3/favicon_green.png +0 -0
- data/spec/coverage/assets/0.5.3/favicon_red.png +0 -0
- data/spec/coverage/assets/0.5.3/favicon_yellow.png +0 -0
- data/spec/coverage/assets/0.5.3/highlight.css +0 -129
- data/spec/coverage/assets/0.5.3/highlight.pack.js +0 -1
- data/spec/coverage/assets/0.5.3/jquery-1.6.2.min.js +0 -18
- data/spec/coverage/assets/0.5.3/jquery.dataTables.min.js +0 -152
- data/spec/coverage/assets/0.5.3/jquery.timeago.js +0 -141
- data/spec/coverage/assets/0.5.3/jquery.url.js +0 -174
- data/spec/coverage/assets/0.5.3/loading.gif +0 -0
- data/spec/coverage/assets/0.5.3/magnify.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/spec/coverage/assets/0.5.3/smoothness/jquery-ui-1.8.4.custom.css +0 -295
- data/spec/coverage/assets/0.5.3/stylesheet.css +0 -383
@@ -1,9 +1,11 @@
|
|
1
1
|
|
2
2
|
require 'hand_evaluator'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
module AcpcPokerTypes
|
5
|
+
class PileOfCards < Array
|
6
|
+
# @return [Integer] The strength of the strongest poker hand that can be made from this pile of cards.
|
7
|
+
def to_poker_hand_strength
|
8
|
+
HandEvaluator.rank_hand map { |card| card.to_i }
|
9
|
+
end
|
8
10
|
end
|
9
11
|
end
|
@@ -5,172 +5,177 @@ require 'acpc_poker_types/chip_stack'
|
|
5
5
|
require 'acpc_poker_types/hand'
|
6
6
|
|
7
7
|
# Class to model a player.
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
players
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
8
|
+
module AcpcPokerTypes
|
9
|
+
class Player
|
10
|
+
exceptions :incorrect_number_of_player_names
|
11
|
+
|
12
|
+
def self.create_players(player_names, game_def)
|
13
|
+
if game_def.number_of_players != player_names.length
|
14
|
+
raise(
|
15
|
+
IncorrectNumberOfPlayerNames,
|
16
|
+
"#{player_names.length} names for #{game_def.number_of_players} players"
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
game_def.number_of_players.times.inject([]) do |players, seat|
|
21
|
+
players << AcpcPokerTypes::Player.join_match(
|
22
|
+
player_names[seat],
|
23
|
+
seat,
|
24
|
+
AcpcPokerTypes::ChipStack.new(game_def.chip_stacks[seat])
|
25
|
+
)
|
26
|
+
end
|
25
27
|
end
|
26
|
-
end
|
27
28
|
|
28
|
-
|
29
|
-
|
29
|
+
# @return [String] The name of this player.
|
30
|
+
attr_reader :name
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
32
|
+
# @return [Integer] This player's seat. This is a 0 indexed
|
33
|
+
# number that represents the order that this player joined the dealer.
|
34
|
+
attr_reader :seat
|
34
35
|
|
35
|
-
|
36
|
-
|
36
|
+
# @return [AcpcPokerTypes::ChipStack] This player's chip stack.
|
37
|
+
attr_reader :chip_stack
|
37
38
|
|
38
|
-
|
39
|
-
|
40
|
-
|
39
|
+
# @return [Array<AcpcPokerTypes::ChipStack>] This player's contribution to the pot in the
|
40
|
+
# current hand, organized by round.
|
41
|
+
attr_reader :chip_contributions
|
41
42
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
43
|
+
# @return [Integer] The amount this player has won or lost in the current
|
44
|
+
# match. During a hand, this is a projected amount assuming that this
|
45
|
+
# player loses. Positive amounts are winnings, negative amounts are losses.
|
46
|
+
attr_reader :chip_balance
|
46
47
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
48
|
+
# @return [Hand] This player's hole cards or nil if this player is not
|
49
|
+
# holding cards.
|
50
|
+
# @example (see MatchState#users_hole_cards)
|
51
|
+
attr_reader :hole_cards
|
51
52
|
|
52
|
-
|
53
|
-
|
54
|
-
|
53
|
+
# @return [Array<Array<String>>] The list of actions this player has taken in
|
54
|
+
# the current hand, separated by round.
|
55
|
+
attr_reader :actions_taken_this_hand
|
55
56
|
|
56
|
-
|
57
|
+
alias_new :join_match
|
57
58
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
59
|
+
# @todo These comments don't work as expected
|
60
|
+
# @param [String] name This players name.
|
61
|
+
# @param [Integer] seat (see #seat)
|
62
|
+
# @param [#to_i] chip_stack (see #chip_stack)
|
63
|
+
def initialize(name, seat, chip_stack)
|
64
|
+
@name = name
|
65
|
+
@seat = seat
|
66
|
+
@chip_balance = 0
|
67
|
+
@chip_stack = chip_stack
|
68
|
+
@chip_contributions = [0]
|
68
69
|
|
69
|
-
|
70
|
-
|
70
|
+
@actions_taken_this_hand = [[]]
|
71
|
+
end
|
71
72
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
73
|
+
def ==(other)
|
74
|
+
equal_on_public_info?(other) &&
|
75
|
+
@hole_cards == other.hole_cards
|
76
|
+
end
|
76
77
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
78
|
+
def equal_on_public_info?(other)
|
79
|
+
@name == other.name &&
|
80
|
+
@seat == other.seat &&
|
81
|
+
@chip_stack == other.chip_stack &&
|
82
|
+
@chip_contributions == other.chip_contributions &&
|
83
|
+
@chip_balance == other.chip_balance &&
|
84
|
+
@actions_taken_this_hand == other.actions_taken_this_hand
|
85
|
+
end
|
85
86
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
87
|
+
# @param [#to_i] blind_amount The blind amount for this player to pay.
|
88
|
+
# @param [#to_i] chip_stack (see #chip_stack)
|
89
|
+
# @param [Hand] hole_cards (see #hole_cards)
|
90
|
+
def start_new_hand!(blind=AcpcPokerTypes::ChipStack.new(0), chip_stack=@chip_stack, hole_cards=AcpcPokerTypes::Hand.new)
|
91
|
+
@chip_stack = chip_stack
|
92
|
+
@hole_cards = hole_cards
|
93
|
+
@actions_taken_this_hand = []
|
94
|
+
@chip_contributions = []
|
94
95
|
|
95
|
-
|
96
|
+
start_new_round!
|
96
97
|
|
97
|
-
|
98
|
-
|
98
|
+
pay_blind! blind
|
99
|
+
end
|
99
100
|
|
100
|
-
|
101
|
-
|
102
|
-
|
101
|
+
def start_new_round!
|
102
|
+
@actions_taken_this_hand << []
|
103
|
+
@chip_contributions << 0
|
103
104
|
|
104
|
-
|
105
|
-
|
105
|
+
self
|
106
|
+
end
|
106
107
|
|
107
|
-
|
108
|
-
|
109
|
-
@
|
108
|
+
# @param [PokerAction] action The action to take.
|
109
|
+
# @param pot_gained_chips [Boolean] Whether or not the pot had gained chips before this action. Defaults to true.
|
110
|
+
# @param sees_wager [Boolean] Whether or not the player is reacting to a wager.
|
111
|
+
# Defaults to the value of +pot_gained_chips+.
|
112
|
+
def take_action!(action, pot_gained_chips: true, sees_wager: pot_gained_chips)
|
113
|
+
@actions_taken_this_hand.last << action.to_s(pot_gained_chips: pot_gained_chips, player_sees_wager: sees_wager)
|
110
114
|
|
111
|
-
|
112
|
-
|
115
|
+
take_from_chip_stack! action.cost.to_r
|
116
|
+
end
|
113
117
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
+
# @return [Boolean] Reports whether or not this player has folded.
|
119
|
+
def folded?
|
120
|
+
@actions_taken_this_hand.any? do |actions|
|
121
|
+
actions.any? { |action| action == AcpcPokerTypes::PokerAction::FOLD }
|
122
|
+
end
|
118
123
|
end
|
119
|
-
end
|
120
124
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
+
# @return [Boolean] Reports whether or not this player is all-in.
|
126
|
+
def all_in?
|
127
|
+
0 == @chip_stack
|
128
|
+
end
|
125
129
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
130
|
+
# @return [Boolean] Whether or not this player is active (has not folded
|
131
|
+
# or gone all-in). +true+ if this player is active, +false+ otherwise.
|
132
|
+
def active?
|
133
|
+
!(folded? || all_in?)
|
134
|
+
end
|
131
135
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
+
# @return [Integer] The current round, zero indexed.
|
137
|
+
def round
|
138
|
+
@actions_taken_this_hand.length - 1
|
139
|
+
end
|
136
140
|
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
+
# Adjusts this player's state when it takes chips from the pot.
|
142
|
+
# @param [Integer] chips The number of chips this player has won from the pot.
|
143
|
+
def take_winnings!(chips)
|
144
|
+
@chip_contributions << 0
|
141
145
|
|
142
|
-
|
143
|
-
|
146
|
+
add_to_stack! chips
|
147
|
+
end
|
144
148
|
|
145
|
-
|
146
|
-
|
149
|
+
def assign_cards!(hole_cards)
|
150
|
+
@hole_cards = hole_cards
|
147
151
|
|
148
|
-
|
149
|
-
|
152
|
+
self
|
153
|
+
end
|
150
154
|
|
151
|
-
|
155
|
+
private
|
152
156
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
+
# @param [#to_i] blind_amount The blind amount for this player to pay.
|
158
|
+
def pay_blind!(blind_amount)
|
159
|
+
take_from_chip_stack! blind_amount
|
160
|
+
end
|
157
161
|
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
+
def add_to_stack!(chips)
|
163
|
+
@chip_stack += chips
|
164
|
+
@chip_balance += chips.to_r
|
165
|
+
@chip_contributions[-1] -= chips.to_r
|
162
166
|
|
163
|
-
|
164
|
-
|
167
|
+
self
|
168
|
+
end
|
165
169
|
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
170
|
+
# Take chips away from this player's chip stack.
|
171
|
+
# @param (see AcpcPokerTypes::ChipStack#-)
|
172
|
+
# @raise (see AcpcPokerTypes::ChipStack#-)
|
173
|
+
def take_from_chip_stack!(number_of_chips)
|
174
|
+
@chip_stack -= number_of_chips
|
175
|
+
@chip_balance -= number_of_chips.to_r
|
176
|
+
@chip_contributions[-1] += number_of_chips.to_r
|
173
177
|
|
174
|
-
|
178
|
+
self
|
179
|
+
end
|
175
180
|
end
|
176
|
-
end
|
181
|
+
end
|
@@ -4,118 +4,108 @@ require 'dmorrill10-utils/class'
|
|
4
4
|
|
5
5
|
require 'acpc_poker_types/chip_stack'
|
6
6
|
|
7
|
-
|
7
|
+
module AcpcPokerTypes
|
8
|
+
class PokerAction
|
9
|
+
exceptions :illegal_action, :illegal_modification
|
8
10
|
|
9
|
-
|
11
|
+
BET = 'b'
|
12
|
+
CALL = 'c'
|
13
|
+
CHECK = 'k'
|
14
|
+
FOLD = 'f'
|
15
|
+
RAISE = 'r'
|
10
16
|
|
11
|
-
|
12
|
-
# Could be negative to imply the acting player takes chips from the pot.
|
13
|
-
attr_reader :amount_to_put_in_pot
|
17
|
+
ACTIONS = Set.new [BET, CALL, CHECK, FOLD, RAISE]
|
14
18
|
|
15
|
-
|
16
|
-
|
19
|
+
# @return [Set<String>] The set of legal ACPC action characters.
|
20
|
+
CANONICAL_ACTIONS = Set.new [CALL, FOLD, RAISE]
|
17
21
|
|
18
|
-
|
19
|
-
LEGAL_ACTIONS = {bet: 'b', call: 'c', check: 'k', fold: 'f', raise: 'r'}
|
22
|
+
MODIFIABLE_ACTIONS = Set.new [BET, RAISE]
|
20
23
|
|
21
|
-
|
22
|
-
LEGAL_SYMBOLS = Set.new LEGAL_ACTIONS.keys
|
24
|
+
CONCATONATED_ACTIONS = ACTIONS.to_a.join
|
23
25
|
|
24
|
-
|
25
|
-
|
26
|
+
# @return [Rational] The amount that the player taking this action needs to put in the pot.
|
27
|
+
# Could be negative to imply the acting player takes chips from the pot.
|
28
|
+
attr_reader :cost
|
26
29
|
|
27
|
-
|
28
|
-
|
30
|
+
# @return [String] A modifier for the action (i.e. a bet or raise size).
|
31
|
+
attr_reader :modifier
|
29
32
|
|
30
|
-
|
31
|
-
|
33
|
+
# @return [String] Action character
|
34
|
+
attr_reader :action
|
35
|
+
alias_method :to_acpc_character, :action
|
32
36
|
|
33
|
-
|
34
|
-
|
37
|
+
# @return [Boolean] Whether or not the pot has been added to this round before this action.
|
38
|
+
attr_reader :pot_gained_chips
|
35
39
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
if context[:acting_player_sees_wager].nil?
|
45
|
-
true
|
46
|
-
else
|
47
|
-
context[:acting_player_sees_wager]
|
48
|
-
end
|
49
|
-
)
|
50
|
-
@amount_to_put_in_pot = context[:amount_to_put_in_pot].to_i
|
51
|
-
end
|
52
|
-
|
53
|
-
def ==(other_action)
|
54
|
-
to_sym == other_action.to_sym && to_s == other_action.to_s && to_acpc == other_action.to_acpc && @modifier == other_action.modifier
|
55
|
-
end
|
56
|
-
|
57
|
-
# @return [Boolean] +true+ if this action has a modifier, +false+ otherwise.
|
58
|
-
def has_modifier?
|
59
|
-
!@modifier.nil?
|
60
|
-
end
|
61
|
-
|
62
|
-
# @return [Symbol]
|
63
|
-
def to_sym
|
64
|
-
@symbol
|
65
|
-
end
|
66
|
-
|
67
|
-
# @return [String] String representation of this action.
|
68
|
-
def to_s
|
69
|
-
@symbol.to_s + @modifier.to_s
|
70
|
-
end
|
40
|
+
# @param [Symbol, String] action A representation of this action.
|
41
|
+
# @param [Hash] context The context in which this action is being made. Recognized keys include +:modifier+,
|
42
|
+
# +:pot_gained_chips+, and +:cost+.
|
43
|
+
# @raise IllegalAction
|
44
|
+
def initialize(action, modifier: nil, cost: AcpcPokerTypes::ChipStack.new(0))
|
45
|
+
validate_action!(action, modifier)
|
46
|
+
@cost = cost
|
47
|
+
end
|
71
48
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
end
|
49
|
+
def ==(other_action)
|
50
|
+
to_s == other_action.to_s
|
51
|
+
end
|
76
52
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
53
|
+
# @return [String] String representation of this action.
|
54
|
+
# @param pot_gained_chips [Boolean] Whether or not the pot had gained chips before this action. Defaults to true.
|
55
|
+
# @param player_sees_wager [Boolean] Whether or not the player is reacting to a wager.
|
56
|
+
# Defaults to the value of +pot_gained_chips+.
|
57
|
+
def to_s(pot_gained_chips: true, player_sees_wager: pot_gained_chips)
|
58
|
+
combine_action_and_modifier(
|
59
|
+
if @action == FOLD
|
60
|
+
@action
|
61
|
+
elsif @action == BET || @action == RAISE
|
62
|
+
if pot_gained_chips then RAISE else BET end
|
63
|
+
elsif @action == CALL || @action == CHECK
|
64
|
+
if player_sees_wager then CALL else CHECK end
|
65
|
+
end
|
66
|
+
)
|
67
|
+
end
|
81
68
|
|
82
|
-
|
69
|
+
alias_method :to_acpc, :to_s
|
83
70
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
elsif action.to_s.match(/^([#{LEGAL_ACPC_CHARACTERS.to_a.join('')}])\s*(\d*)$/)
|
88
|
-
else
|
89
|
-
raise(IllegalAction, action.to_s)
|
71
|
+
# @return [Boolean] +true+ if this action has a modifier, +false+ otherwise.
|
72
|
+
def has_modifier?
|
73
|
+
!@modifier.nil?
|
90
74
|
end
|
91
|
-
action_type, in_place_modifier = $1, $2
|
92
75
|
|
93
|
-
|
76
|
+
private
|
94
77
|
|
95
|
-
|
96
|
-
modifier
|
97
|
-
elsif !in_place_modifier.empty?
|
98
|
-
AcpcPokerTypes::ChipStack.new in_place_modifier.to_i
|
78
|
+
def combine_action_and_modifier(action=@action, modifier=@modifier)
|
79
|
+
action + modifier.to_s
|
99
80
|
end
|
100
81
|
|
101
|
-
|
102
|
-
|
82
|
+
def validate_action!(action, given_modifier)
|
83
|
+
if action.to_s.match(/^([#{CONCATONATED_ACTIONS}])\s*(\d*)$/)
|
84
|
+
else
|
85
|
+
raise IllegalAction, action.to_s
|
86
|
+
end
|
87
|
+
@action, @modifier = $1, $2
|
88
|
+
|
89
|
+
if given_modifier && !@modifier.empty?
|
90
|
+
raise(
|
91
|
+
IllegalModification,
|
92
|
+
"in-place modifier: #{@modifier}, explicit modifier: #{given_modifier}"
|
93
|
+
)
|
94
|
+
end
|
103
95
|
|
104
|
-
|
96
|
+
@modifier = if !@modifier.empty?
|
97
|
+
@modifier
|
98
|
+
elsif given_modifier
|
99
|
+
given_modifier
|
100
|
+
end
|
105
101
|
|
106
|
-
|
107
|
-
[action_symbol, action_modifier]
|
108
|
-
end
|
102
|
+
validate_modifier
|
109
103
|
|
110
|
-
|
111
|
-
|
112
|
-
modifier
|
113
|
-
end
|
104
|
+
self
|
105
|
+
end
|
114
106
|
|
115
|
-
|
116
|
-
|
117
|
-
return action
|
107
|
+
def validate_modifier
|
108
|
+
raise(IllegalModification, "Illegal modifier: #{@modifier}") unless @modifier.nil? || AcpcPokerTypes::PokerAction::MODIFIABLE_ACTIONS.include?(@action)
|
118
109
|
end
|
119
|
-
HIGH_RESOLUTION_ACTION_CONVERSION[action]
|
120
110
|
end
|
121
|
-
end
|
111
|
+
end
|