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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cf4a662df53981779afe312943fa1996748dd309
4
- data.tar.gz: 547a075acfb8a697167988ae17e5842c15c39a7b
3
+ metadata.gz: b378fe2dc98924d94e875eb6922513dce8f9cef8
4
+ data.tar.gz: 108c6cecd2aac96a8354a40322a9fa67d76ee945
5
5
  SHA512:
6
- metadata.gz: bcb73630246a764fa4cc7ad24b3e1a79de53f4504dcde8f8c78f5906d49df5c0eeedba8132ed4f5dbb5e7a497abba04c5e89189e7b6321e3243e9c41f3edd7bb
7
- data.tar.gz: a7a5aa7d38e73fa2c1391367c1cbb97ce40fd41ecde181d62b09543fc0e17d07abf635a92a0e70db3acda77552fc218dd818a035964b32cecb67ff6dcc201adb
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.to_i.times.inject([]) do |list, i|
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.to_i.times.inject([]) do |list, i|
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.to_i.times.inject([]) do |list, i|
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 = AcpcPokerTypes::GameDefinition.default_chip_stacks(@number_of_players) if @chip_stacks.empty?
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 = AcpcPokerTypes::GameDefinition.default_first_player_positions @number_of_rounds
244
- @max_number_of_wagers = AcpcPokerTypes::GameDefinition.default_max_number_of_wagers @number_of_rounds
245
- @chip_stacks = AcpcPokerTypes::GameDefinition.default_chip_stacks @number_of_players
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 = AcpcPokerTypes::GameDefinition.check_game_def_line_for_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
- AcpcPokerTypes::GameDefinition.game_def_line_not_informative?(line) ||
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
@@ -1,3 +1,3 @@
1
1
  module AcpcPokerTypes
2
- VERSION = '7.3.1'
2
+ VERSION = '7.3.2'
3
3
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acpc_poker_types
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.3.1
4
+ version: 7.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Morrill