acpc_poker_match_state 0.0.3 → 0.0.4

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: 6618d28c4865bcd57c7e77e4ee6b6d11fb5dad90
4
- data.tar.gz: 35417f8b38e6a3ceeb9d0c33439a7f2188c73f47
3
+ metadata.gz: 9b99cb18af5d5209190310006d6fedcb99de6659
4
+ data.tar.gz: 0b0d99312c5bd4fcfba3f22d0a8ec82d1a2f4cdc
5
5
  SHA512:
6
- metadata.gz: 1ecdb73fb76a72af30fcdfd3bd4a4268244ba555f9b9f034a80cef88da3c552bd5fef4da43c9a36aba8f2f7404b06f1b994af93edd85dfa9adcae35f44741269
7
- data.tar.gz: a759861ac7d87f384dcf1087baa2b15cf28bb49d245444aaf0e37d5dd9739f7f4a76a83b9deceff73fc632f7b7483e8217dd12e36763073a780991ba63ea2829
6
+ metadata.gz: 6518c6631753952423fb7a0f52bfd9c10dab4762853af855c981d1a3a6470c73cc1c88c0c142522ec3c4a28be12307598efdf7b43a52cbec9454a8fb07b0ae87
7
+ data.tar.gz: d043a2a7de1b4c712a1cd027d3aacf93e376ee3949c4c7a530814993aa7fb724153a3c0050d4b4e9d6a341deba4f5b8fb280e25eb346800e238f5a0202040d5f
data/Rakefile CHANGED
@@ -4,9 +4,6 @@ require 'rake'
4
4
  require 'rake/testtask'
5
5
 
6
6
  require File.expand_path('../lib/acpc_poker_match_state/version', __FILE__)
7
- require File.expand_path('../tasks', __FILE__)
8
-
9
- include Tasks
10
7
 
11
8
  Rake::TestTask.new do |t|
12
9
  t.libs << "lib" << 'spec/support'
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
 
16
16
  s.rubyforge_project = "acpc_poker_match_state"
17
17
 
18
- s.files = Dir.glob("lib/**/*") + Dir.glob("ext/**/*") + %w(Rakefile acpc_poker_match_state.gemspec tasks.rb README.md)
18
+ s.files = Dir.glob("lib/**/*") + Dir.glob("ext/**/*") + %w(Rakefile acpc_poker_match_state.gemspec README.md)
19
19
  s.test_files = Dir.glob "spec/**/*"
20
20
  s.require_paths = ["lib"]
21
21
 
@@ -261,9 +261,9 @@ class PlayersAtTheTable
261
261
 
262
262
  def cost_of_action(player, action, round=round_in_which_last_action_taken)
263
263
  ChipStack.new(
264
- if action.to_sym == :call
264
+ if action.to_acpc_character == 'c'
265
265
  amount_to_call player
266
- elsif action.to_sym == :bet || action.to_sym == :raise
266
+ elsif action.to_acpc_character == 'b' || action.to_acpc_character == 'r'
267
267
  if action.modifier
268
268
  action.modifier - player.chip_contributions.sum
269
269
  else
@@ -277,18 +277,18 @@ class PlayersAtTheTable
277
277
 
278
278
  # @return [Set] The set of legal actions for the currently acting player.
279
279
  def legal_actions
280
- list_of_action_symbols = if next_player_to_act.nil?
280
+ list_of_actions = if next_player_to_act.nil?
281
281
  []
282
282
  elsif player_sees_wager?
283
- [:call, :fold, :raise]
283
+ ['c', 'f', 'r']
284
284
  elsif chips_contributed_to_pot_this_round?
285
- [:check, :raise]
285
+ ['k', 'r']
286
286
  else
287
- [:check, :bet]
287
+ ['k', 'b']
288
288
  end
289
289
 
290
- list_of_action_symbols.inject(Set.new) do |set, action_symbol|
291
- set << PokerAction.new(action_symbol)
290
+ list_of_actions.inject(Set.new) do |set, action|
291
+ set << PokerAction.new(action)
292
292
  end
293
293
  end
294
294
 
@@ -365,10 +365,12 @@ class PlayersAtTheTable
365
365
  acting_player_sees_wager: chips_contributed_to_pot_this_round?(@transition.next_state.round_in_which_last_action_taken)
366
366
  }
367
367
  )
368
- player_who_acted_last.take_action! action_with_context
368
+ unless action_with_context.to_acpc_character == 'f'
369
+ last_amount_called = amount_to_call(player_who_acted_last)
370
+ @min_wager = ChipStack.new [@min_wager.to_r, action_with_context.amount_to_put_in_pot.to_r - last_amount_called].max
371
+ end
369
372
 
370
- # @todo I'm concerned that this doesn't work properly in multiplayer...
371
- @min_wager = ChipStack.new [@min_wager.to_i, action_with_context.amount_to_put_in_pot.to_i].max
373
+ player_who_acted_last.take_action! action_with_context
372
374
 
373
375
  if @transition.new_round?
374
376
  active_players.each { |player| player.start_new_round! }
@@ -403,6 +405,7 @@ class PlayersAtTheTable
403
405
  end.map { |player_with_hand_strength| player_with_hand_strength.first }
404
406
 
405
407
  amount_each_player_wins = pot/winning_players.length.to_r
408
+
406
409
  winning_players.each do |player|
407
410
  player.take_winnings! amount_each_player_wins
408
411
  end
@@ -1,3 +1,3 @@
1
1
  module AcpcPokerMatchState
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acpc_poker_match_state
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Morrill
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-01 00:00:00.000000000 Z
11
+ date: 2013-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: acpc_poker_types
@@ -149,7 +149,6 @@ files:
149
149
  - lib/acpc_poker_match_state/match_state_transition.rb
150
150
  - Rakefile
151
151
  - acpc_poker_match_state.gemspec
152
- - tasks.rb
153
152
  - README.md
154
153
  - spec/support/dealer_logs/3p.limit.h1000.r0.actions.log
155
154
  - spec/support/dealer_logs/3p.limit.h1000.r0.log
data/tasks.rb DELETED
@@ -1,10 +0,0 @@
1
- require 'fileutils'
2
-
3
- module Tasks
4
- def tag_gem_version(version)
5
- puts "Tagging #{version}..."
6
- system "git tag -a #{version} -m 'Tagging #{version}'"
7
- puts "Pushing #{version} to git..."
8
- system "git push --tags"
9
- end
10
- end