acpc_dealer_data 0.2.2 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -188,7 +188,11 @@ class PokerMatchData
188
188
  def player_acting_sequence
189
189
  sequence = [[]]
190
190
 
191
- if @hand_number.nil? || current_hand.turn_number.nil? || current_hand.turn_number < 1
191
+ if (
192
+ @hand_number.nil? ||
193
+ current_hand.turn_number.nil? ||
194
+ current_hand.turn_number < 1
195
+ )
192
196
  return sequence
193
197
  end
194
198
 
@@ -262,6 +266,55 @@ class PokerMatchData
262
266
  relation
263
267
  end
264
268
  end
269
+
270
+ # @todo Untested
271
+ # @return [String] player acting sequence as a string.
272
+ def player_acting_sequence_string
273
+ (player_acting_sequence.map { |per_round| per_round.join('') }).join('/')
274
+ end
275
+ def users_turn_to_act?
276
+ return false unless current_hand && current_hand.next_action
277
+ current_hand.next_action.seat == @seat
278
+ end
279
+ def betting_sequence
280
+ sequence = [[]]
281
+
282
+ if (
283
+ @hand_number.nil? ||
284
+ current_hand.turn_number.nil? ||
285
+ current_hand.turn_number < 1
286
+ )
287
+ return sequence
288
+ end
289
+
290
+ turns_taken = current_hand.data[0..current_hand.turn_number-1]
291
+ turns_taken.each_with_index do |turn, turn_index|
292
+ next unless turn.action_message
293
+
294
+ sequence[turn.action_message.state.round] << turn.action_message.action
295
+
296
+ if (
297
+ new_round?(sequence.length - 1 , turn_index) ||
298
+ players_all_in?(sequence.length - 1, turn_index, turns_taken)
299
+ )
300
+ sequence << []
301
+ end
302
+ end
303
+
304
+ sequence
305
+ end
306
+ def betting_sequence_string
307
+ (betting_sequence.map do |per_round|
308
+ (per_round.map{|action| action.to_acpc}).join('')
309
+ end).join('/')
310
+ end
311
+ # @todo Test and implement this
312
+ # def min_wager
313
+ # return nil unless current_hand
314
+
315
+ # @match_def.game_def.min_wagers[current_hand.next_state.round]
316
+ # ChipStack.new [@min_wager.to_i, action_with_context.amount_to_put_in_pot.to_i].max
317
+ # end
265
318
 
266
319
  protected
267
320
 
@@ -1,3 +1,3 @@
1
1
  module AcpcDealerData
2
- VERSION = "0.2.2"
2
+ VERSION = "0.3.2"
3
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.2.2
4
+ version: 0.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-03 00:00:00.000000000 Z
12
+ date: 2013-01-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: acpc_dealer
@@ -164,7 +164,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
164
164
  version: '0'
165
165
  segments:
166
166
  - 0
167
- hash: 1139610664980241353
167
+ hash: 1700059330074099267
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: 1139610664980241353
176
+ hash: 1700059330074099267
177
177
  requirements: []
178
178
  rubyforge_project:
179
179
  rubygems_version: 1.8.24