acpc_poker_types 7.3.1 → 7.3.2
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/lib/acpc_poker_types/game_definition.rb +10 -15
- data/lib/acpc_poker_types/version.rb +1 -1
- data/spec/match_state_spec.rb +18 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b378fe2dc98924d94e875eb6922513dce8f9cef8
|
4
|
+
data.tar.gz: 108c6cecd2aac96a8354a40322a9fa67d76ee945
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3eed96e5678f2380a56231aef485d7ac97b8d0568e4c7d0dbe575831f4bfedc014725b911fd0ce3c16b7f6fd5d8cc9ef8f9f486f124dca02f275628bd796f453
|
7
|
+
data.tar.gz: eca79da53c9fb133be433fffaf3239c852f50d0c79afc47909be35d45066753d4098192ba627427c8df0f0333ff4dd61b8fcd2fc83c0a63fdee6f10a56cca6c8
|
@@ -106,24 +106,18 @@ module AcpcPokerTypes
|
|
106
106
|
]
|
107
107
|
|
108
108
|
def self.default_first_player_positions(number_of_rounds)
|
109
|
-
number_of_rounds.
|
110
|
-
list << 0
|
111
|
-
end
|
109
|
+
number_of_rounds.times.map { 0 }
|
112
110
|
end
|
113
111
|
|
114
112
|
# @return [Array] The default maximum raise in each round.
|
115
113
|
def self.default_max_number_of_wagers(number_of_rounds)
|
116
|
-
number_of_rounds.
|
117
|
-
list << DEFAULT_MAX_NUMBER_OF_WAGERS
|
118
|
-
end
|
114
|
+
number_of_rounds.times.map { DEFAULT_MAX_NUMBER_OF_WAGERS }
|
119
115
|
end
|
120
116
|
|
121
117
|
# @param [Integer] number_of_players The number of players that require stacks.
|
122
118
|
# @return [Array<AcpcPokerTypes::ChipStack>] The default list of initial stacks for every player.
|
123
119
|
def self.default_chip_stacks(number_of_players)
|
124
|
-
number_of_players.
|
125
|
-
list << AcpcPokerTypes::ChipStack.new(DEFAULT_CHIP_STACK)
|
126
|
-
end
|
120
|
+
number_of_players.times.map { ChipStack.new(DEFAULT_CHIP_STACK) }
|
127
121
|
end
|
128
122
|
|
129
123
|
# Checks if the given line is a comment beginning with '#' or ';', or empty.
|
@@ -179,7 +173,7 @@ module AcpcPokerTypes
|
|
179
173
|
parse_definitions! definitions
|
180
174
|
end
|
181
175
|
|
182
|
-
@chip_stacks =
|
176
|
+
@chip_stacks = self.class.default_chip_stacks(@number_of_players) if @chip_stacks.empty?
|
183
177
|
|
184
178
|
unless @first_player_positions.any? { |pos| pos <= 0 }
|
185
179
|
@first_player_positions.map! { |position| position - 1 }
|
@@ -240,9 +234,9 @@ module AcpcPokerTypes
|
|
240
234
|
@blinds = @number_of_players.times.inject([]) { |blinds, i| blinds << 0 }
|
241
235
|
@number_of_rounds = MIN_VALUES[:@number_of_rounds]
|
242
236
|
@number_of_board_cards = @number_of_rounds.times.inject([]) { |cards, i| cards << 0 }
|
243
|
-
@first_player_positions =
|
244
|
-
@max_number_of_wagers =
|
245
|
-
@chip_stacks =
|
237
|
+
@first_player_positions = self.class.default_first_player_positions @number_of_rounds
|
238
|
+
@max_number_of_wagers = self.class.default_max_number_of_wagers @number_of_rounds
|
239
|
+
@chip_stacks = self.class.default_chip_stacks @number_of_players
|
246
240
|
@number_of_suits = MIN_VALUES[:@number_of_suits]
|
247
241
|
@number_of_ranks = MIN_VALUES[:@number_of_ranks]
|
248
242
|
@number_of_hole_cards = MIN_VALUES[:@number_of_hole_cards]
|
@@ -251,7 +245,7 @@ module AcpcPokerTypes
|
|
251
245
|
end
|
252
246
|
|
253
247
|
def set_defintion_if_present!(definition_symbol, line, definition_label_in_line)
|
254
|
-
new_definition =
|
248
|
+
new_definition = self.class.check_game_def_line_for_definition(
|
255
249
|
line,
|
256
250
|
definition_label_in_line
|
257
251
|
)
|
@@ -282,7 +276,7 @@ module AcpcPokerTypes
|
|
282
276
|
definitions.each do |line|
|
283
277
|
break if line.match(/\bend\s*gamedef\b/i)
|
284
278
|
next if (
|
285
|
-
|
279
|
+
self.class.game_def_line_not_informative?(line) ||
|
286
280
|
BETTING_TYPES.any? do |type_and_name|
|
287
281
|
type = type_and_name.first
|
288
282
|
name = type_and_name[1]
|
@@ -372,6 +366,7 @@ module AcpcPokerTypes
|
|
372
366
|
@number_of_rounds.times do |i|
|
373
367
|
@first_player_positions << 0 unless @first_player_positions.length > i
|
374
368
|
@number_of_board_cards << 0 unless @number_of_board_cards.length > i
|
369
|
+
@max_number_of_wagers << DEFAULT_MAX_NUMBER_OF_WAGERS unless @max_number_of_wagers.length > i
|
375
370
|
end
|
376
371
|
end
|
377
372
|
end
|
data/spec/match_state_spec.rb
CHANGED
@@ -658,6 +658,24 @@ describe MatchState do
|
|
658
658
|
end
|
659
659
|
end
|
660
660
|
end
|
661
|
+
it 'when players are all-in' do
|
662
|
+
game_def = GameDefinition.new(
|
663
|
+
:betting_type=>"nolimit",
|
664
|
+
:chip_stacks=>[20000, 20000],
|
665
|
+
:number_of_players=>2,
|
666
|
+
:blinds=>[100, 50],
|
667
|
+
:raise_sizes=>nil,
|
668
|
+
:number_of_rounds=>4,
|
669
|
+
:first_player_positions=>[1, 0, 0, 0],
|
670
|
+
:number_of_suits=>4,
|
671
|
+
:number_of_ranks=>13,
|
672
|
+
:number_of_hole_cards=>2,
|
673
|
+
:number_of_board_cards=>[0, 3, 1, 1]
|
674
|
+
)
|
675
|
+
MatchState.parse(
|
676
|
+
'MATCHSTATE:0:2:cr20000c///:8h8s|5s5c/KdTcKh/9h/Jh'
|
677
|
+
).players(game_def).map { |pl| pl.winnings }.must_equal [40000, 0]
|
678
|
+
end
|
661
679
|
end
|
662
680
|
end
|
663
681
|
describe '#pot' do
|