acpc_dealer_data 0.1.5 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -126,14 +126,8 @@ class PokerMatchData
126
126
  self
127
127
  end
128
128
 
129
- def player_name(seat=@seat) @players[seat].name end
130
- def chip_balance(seat=@seat) @players[seat].chip_balance end
131
- def hole_cards(seat=@seat) @players[seat].hole_cards end
132
- def actions_taken_this_hand(seat=@seat) @players[seat].actions_taken_this_hand end
133
- def folded?(seat=@seat) @players[seat].folded? end
134
- def all_in?(seat=@seat) @players[seat].all_in? end
135
- def active?(seat=@seat) @players[seat].active? end
136
-
129
+ def player(seat=@seat) @players[seat] end
130
+
137
131
  def for_every_hand!
138
132
  initialize_players!
139
133
 
@@ -166,6 +160,7 @@ class PokerMatchData
166
160
  match_state = current_hand.current_match_state(seat)
167
161
 
168
162
  if current_hand.last_action && player.seat == current_hand.last_action.seat
163
+
169
164
  player.take_action!(current_hand.last_action.action)
170
165
  end
171
166
 
@@ -201,7 +196,7 @@ class PokerMatchData
201
196
 
202
197
  if (
203
198
  new_round?(sequence.length - 1 , turn_index) ||
204
- players_all_in?(sequence.length - 1, turn_index)
199
+ players_all_in?(sequence.length - 1, turn_index, turns_taken)
205
200
  )
206
201
  sequence << []
207
202
  end
@@ -218,6 +213,21 @@ class PokerMatchData
218
213
  if @hand_number then @hand_number >= @data.length - 1 else nil end
219
214
  end
220
215
 
216
+ # @return [Array<ChipStack>] Player stacks.
217
+ def chip_stacks
218
+ @players.map { |player| player.chip_stack }
219
+ end
220
+
221
+ # return [Array<Integer>] Each player's current chip balance.
222
+ def chip_balances
223
+ @players.map { |player| player.chip_balance }
224
+ end
225
+
226
+ # return [Array<Array<Integer>>] Each player's current chip contribution organized by round.
227
+ def chip_contributions
228
+ @players.map { |player| player.chip_contributions }
229
+ end
230
+
221
231
  protected
222
232
 
223
233
  def initialize_players!
@@ -260,10 +270,9 @@ class PokerMatchData
260
270
 
261
271
  private
262
272
 
263
- def players_all_in?(current_round, turn_index)
273
+ def players_all_in?(current_round, turn_index, turns_taken)
264
274
  current_hand.data.length == turn_index + 2 &&
265
- current_round < (@match_def.game_def.number_of_rounds - 1) &&
266
- turn.action_message &&
275
+ current_round < (@match_def.game_def.number_of_rounds - 1) &&
267
276
  (turns_taken[0..turn_index].count do |t|
268
277
  t.action_message.action.to_sym == :fold
269
278
  end) != @players.length - 1
@@ -1,3 +1,3 @@
1
1
  module AcpcDealerData
2
- VERSION = "0.1.5"
3
- end
2
+ VERSION = "0.2.0"
3
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acpc_dealer_data
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -164,7 +164,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
164
164
  version: '0'
165
165
  segments:
166
166
  - 0
167
- hash: 4107055564106518345
167
+ hash: 1585358207152026945
168
168
  required_rubygems_version: !ruby/object:Gem::Requirement
169
169
  none: false
170
170
  requirements:
@@ -173,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
173
  version: '0'
174
174
  segments:
175
175
  - 0
176
- hash: 4107055564106518345
176
+ hash: 1585358207152026945
177
177
  requirements: []
178
178
  rubyforge_project:
179
179
  rubygems_version: 1.8.24