acpc_poker_types 0.0.10 → 1.0.0

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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +7 -4
  3. data/acpc_poker_types.gemspec +4 -2
  4. data/lib/acpc_poker_types.rb +13 -12
  5. data/lib/acpc_poker_types/acpc_dealer_data.rb +9 -0
  6. data/lib/acpc_poker_types/acpc_dealer_data/action_messages.rb +133 -0
  7. data/lib/acpc_poker_types/acpc_dealer_data/hand_data.rb +182 -0
  8. data/lib/acpc_poker_types/acpc_dealer_data/hand_results.rb +79 -0
  9. data/lib/acpc_poker_types/acpc_dealer_data/log_file.rb +5 -0
  10. data/lib/acpc_poker_types/acpc_dealer_data/match_definition.rb +54 -0
  11. data/lib/acpc_poker_types/acpc_dealer_data/poker_match_data.rb +393 -0
  12. data/lib/acpc_poker_types/board_cards.rb +4 -4
  13. data/lib/acpc_poker_types/card.rb +16 -16
  14. data/lib/acpc_poker_types/chip_stack.rb +1 -1
  15. data/lib/acpc_poker_types/game_definition.rb +34 -38
  16. data/lib/acpc_poker_types/hand.rb +5 -5
  17. data/lib/acpc_poker_types/match_state.rb +31 -32
  18. data/lib/acpc_poker_types/pile_of_cards.rb +1 -1
  19. data/lib/acpc_poker_types/player.rb +16 -15
  20. data/lib/acpc_poker_types/poker_action.rb +6 -6
  21. data/lib/acpc_poker_types/rank.rb +2 -2
  22. data/lib/acpc_poker_types/suit.rb +4 -4
  23. data/lib/acpc_poker_types/version.rb +1 -1
  24. data/spec/action_messages_spec.rb +450 -0
  25. data/spec/board_cards_spec.rb +9 -9
  26. data/spec/card_spec.rb +20 -20
  27. data/spec/chip_stack_spec.rb +28 -29
  28. data/spec/game_definition_spec.rb +11 -11
  29. data/spec/hand_data_spec.rb +295 -0
  30. data/spec/hand_results_spec.rb +292 -0
  31. data/spec/hand_spec.rb +11 -11
  32. data/spec/match_definition_spec.rb +95 -0
  33. data/spec/match_state_spec.rb +105 -287
  34. data/spec/pile_of_cards_spec.rb +14 -14
  35. data/spec/player_spec.rb +61 -61
  36. data/spec/poker_action_spec.rb +49 -49
  37. data/spec/poker_match_data_spec.rb +388 -0
  38. data/spec/rank_spec.rb +19 -19
  39. data/spec/suit_spec.rb +19 -19
  40. data/spec/support/spec_helper.rb +28 -6
  41. metadata +55 -10
@@ -3,21 +3,21 @@
3
3
  require File.expand_path('../support/spec_helper', __FILE__)
4
4
 
5
5
  require 'hand_evaluator'
6
+ require 'acpc_poker_types/card'
7
+ require 'acpc_poker_types/pile_of_cards'
8
+ require 'acpc_poker_types/rank'
9
+ require 'acpc_poker_types/suit'
6
10
 
7
- require File.expand_path("#{LIB_ACPC_POKER_TYPES_PATH}/card", __FILE__)
8
-
9
- require File.expand_path("#{LIB_ACPC_POKER_TYPES_PATH}/pile_of_cards", __FILE__)
10
-
11
- describe PileOfCards do
11
+ describe AcpcPokerTypes::PileOfCards do
12
12
  describe '#to_poker_hand_strength' do
13
13
  it 'attributes zero hand strength to an empty hand' do
14
- patient = PileOfCards.new
14
+ patient = AcpcPokerTypes::PileOfCards.new
15
15
  hand_strength = 0
16
16
 
17
- patient.to_poker_hand_strength.to_i.should be == hand_strength
17
+ patient.to_poker_hand_strength.to_i.must_equal hand_strength
18
18
  end
19
19
  it "can calculate the Texas hold'em poker hand strength for itself for a seven card set" do
20
- patient = PileOfCards.new
20
+ patient = AcpcPokerTypes::PileOfCards.new
21
21
  cards = []
22
22
  for_every_card do |card|
23
23
  patient << card
@@ -26,10 +26,10 @@ describe PileOfCards do
26
26
  end
27
27
  hand_strength = HandEvaluator.rank_hand cards.map { |card| card.to_i }
28
28
 
29
- patient.to_poker_hand_strength.should be == hand_strength
29
+ patient.to_poker_hand_strength.must_equal hand_strength
30
30
  end
31
31
  it 'attributes the maximum hand strength to a hand with all the cards in the deck' do
32
- patient = PileOfCards.new
32
+ patient = AcpcPokerTypes::PileOfCards.new
33
33
  cards = []
34
34
  for_every_card do |card|
35
35
  patient << card
@@ -37,13 +37,13 @@ describe PileOfCards do
37
37
  end
38
38
  hand_strength = HandEvaluator.rank_hand cards.map { |card| card.to_i }
39
39
 
40
- patient.to_poker_hand_strength.should be == hand_strength
40
+ patient.to_poker_hand_strength.must_equal hand_strength
41
41
  end
42
42
 
43
43
  def for_every_card
44
- Rank::DOMAIN.map do |rank, rank_properties|
45
- Suit::DOMAIN.map do |suit, suit_properties|
46
- yield Card.from_components(rank, suit)
44
+ AcpcPokerTypes::Rank::DOMAIN.map do |rank, rank_properties|
45
+ AcpcPokerTypes::Suit::DOMAIN.map do |suit, suit_properties|
46
+ yield AcpcPokerTypes::Card.from_components(rank, suit)
47
47
  end
48
48
  end
49
49
  end
@@ -5,15 +5,15 @@ require File.expand_path('../support/spec_helper', __FILE__)
5
5
  require 'celluloid'
6
6
 
7
7
  require 'acpc_dealer'
8
- require 'acpc_dealer_data'
8
+ require 'acpc_poker_types/acpc_dealer_data/poker_match_data'
9
9
  require 'dmorrill10-utils'
10
10
 
11
- require File.expand_path("#{LIB_ACPC_POKER_TYPES_PATH}/player", __FILE__)
12
- require File.expand_path("#{LIB_ACPC_POKER_TYPES_PATH}/poker_action", __FILE__)
13
- require File.expand_path("#{LIB_ACPC_POKER_TYPES_PATH}/hand", __FILE__)
14
- require File.expand_path("#{LIB_ACPC_POKER_TYPES_PATH}/match_state", __FILE__)
11
+ require 'acpc_poker_types/player'
12
+ require 'acpc_poker_types/poker_action'
13
+ require 'acpc_poker_types/hand'
14
+ require 'acpc_poker_types/match_state'
15
15
 
16
- describe Player do
16
+ describe AcpcPokerTypes::Player do
17
17
  NAME = 'p1'
18
18
  SEAT = '1'
19
19
  INITIAL_CHIP_STACK = 100000
@@ -41,24 +41,24 @@ describe Player do
41
41
  various_numbers_of_players do |number_of_players|
42
42
  game_def.stubs(:number_of_players).returns(number_of_players)
43
43
 
44
- expect do
45
- Player.create_players(
44
+ -> do
45
+ AcpcPokerTypes::Player.create_players(
46
46
  ((number_of_players-1).times.inject([]) do |names, i|
47
47
  names << "p#{i}"
48
48
  end
49
49
  ),
50
50
  game_def
51
51
  )
52
- end.to raise_exception(Player::IncorrectNumberOfPlayerNames)
53
- expect do
54
- Player.create_players(
52
+ end.must_raise(AcpcPokerTypes::Player::IncorrectNumberOfPlayerNames)
53
+ -> do
54
+ AcpcPokerTypes::Player.create_players(
55
55
  ((number_of_players+1).times.inject([]) do |names, i|
56
56
  names << "p#{i}"
57
57
  end
58
58
  ),
59
59
  game_def
60
60
  )
61
- end.to raise_exception(Player::IncorrectNumberOfPlayerNames)
61
+ end.must_raise(AcpcPokerTypes::Player::IncorrectNumberOfPlayerNames)
62
62
  end
63
63
  end
64
64
  it 'works properly' do
@@ -67,16 +67,16 @@ describe Player do
67
67
  game_def.stubs(:number_of_players).returns(number_of_players)
68
68
  game_def.expects(:chip_stacks).times(number_of_players).returns(INITIAL_CHIP_STACK)
69
69
 
70
- patients = Player.create_players(
70
+ patients = AcpcPokerTypes::Player.create_players(
71
71
  (number_of_players.times.inject([]) do |names, i|
72
72
  names << "p#{i}"
73
73
  end),
74
74
  game_def
75
75
  )
76
76
 
77
- patients.length.should == number_of_players
77
+ patients.length.must_equal number_of_players
78
78
  patients.each do |patient|
79
- patient.class.should == Player
79
+ patient.class.must_equal AcpcPokerTypes::Player
80
80
  end
81
81
  end
82
82
  end
@@ -121,7 +121,7 @@ describe Player do
121
121
  end
122
122
  describe 'reports it is not active if' do
123
123
  it 'it has folded' do
124
- action = PokerAction.new :fold, {amount_to_put_in_pot: 0}
124
+ action = AcpcPokerTypes::PokerAction.new :fold, {amount_to_put_in_pot: 0}
125
125
 
126
126
  @patient.start_new_hand! BLIND, INITIAL_CHIP_STACK
127
127
  @patient.take_action! action
@@ -129,7 +129,7 @@ describe Player do
129
129
  @chip_stack = INITIAL_CHIP_STACK - BLIND
130
130
  @chip_balance = -BLIND
131
131
  @chip_contributions = [BLIND]
132
- @hole_cards = Hand.new
132
+ @hole_cards = AcpcPokerTypes::Hand.new
133
133
  @actions_taken_this_hand = [[action]]
134
134
  @has_folded = true
135
135
  @is_all_in = false
@@ -139,7 +139,7 @@ describe Player do
139
139
  check_patient
140
140
  end
141
141
  it 'it is all-in' do
142
- action = PokerAction.new :raise, {amount_to_put_in_pot: INITIAL_CHIP_STACK - BLIND}
142
+ action = AcpcPokerTypes::PokerAction.new :raise, {amount_to_put_in_pot: INITIAL_CHIP_STACK - BLIND}
143
143
 
144
144
  hand = default_hand
145
145
  @patient.start_new_hand! BLIND, INITIAL_CHIP_STACK, hand
@@ -160,30 +160,30 @@ describe Player do
160
160
  end
161
161
  describe 'properly changes its state when it wins chips' do
162
162
  it 'when the number of chips is an integer' do
163
- @patient.chip_balance.should be == 0
163
+ @patient.chip_balance.must_equal 0
164
164
 
165
165
  pot_size = 22
166
166
  @patient.take_winnings! pot_size
167
167
 
168
- @patient.chip_stack.should be == INITIAL_CHIP_STACK + pot_size
169
- @patient.chip_balance.should be == pot_size
170
- @patient.chip_contributions.should be == [0, -pot_size]
168
+ @patient.chip_stack.must_equal INITIAL_CHIP_STACK + pot_size
169
+ @patient.chip_balance.must_equal pot_size
170
+ @patient.chip_contributions.must_equal [0, -pot_size]
171
171
  end
172
172
  it 'when the number of chips is a rational' do
173
- @patient.chip_balance.should be == 0
173
+ @patient.chip_balance.must_equal 0
174
174
 
175
175
  pot_size = 22/3.to_r
176
176
  @patient.take_winnings! pot_size
177
177
 
178
- @patient.chip_stack.should be == INITIAL_CHIP_STACK + pot_size
179
- @patient.chip_balance.should be == pot_size
180
- @patient.chip_contributions.should be == [0, -pot_size]
178
+ @patient.chip_stack.must_equal INITIAL_CHIP_STACK + pot_size
179
+ @patient.chip_balance.must_equal pot_size
180
+ @patient.chip_contributions.must_equal [0, -pot_size]
181
181
  end
182
182
  end
183
183
  it 'works properly over samples of data from the ACPC Dealer' do
184
184
  dealer_log_directory = File.expand_path('../support/dealer_logs', __FILE__)
185
185
  match_logs.each do |log_description|
186
- match = AcpcDealerData::PokerMatchData.parse_files(
186
+ match = AcpcPokerTypes::AcpcDealerData::PokerMatchData.parse_files(
187
187
  "#{dealer_log_directory}/#{log_description.actions_file_name}",
188
188
  "#{dealer_log_directory}/#{log_description.results_file_name}",
189
189
  log_description.player_names,
@@ -191,7 +191,7 @@ describe Player do
191
191
  40
192
192
  )
193
193
  match.for_every_seat! do |seat|
194
- @patient = Player.join_match(
194
+ @patient = AcpcPokerTypes::Player.join_match(
195
195
  match.match_def.player_names[seat],
196
196
  seat,
197
197
  match.match_def.game_def.chip_stacks[seat]
@@ -222,40 +222,40 @@ describe Player do
222
222
  @patient.take_winnings!(match.current_hand.chip_distribution[seat] + match.match_def.game_def.blinds[seat])
223
223
  end
224
224
 
225
- @patient.name.should == match.player.name
226
- @patient.seat.should == seat
227
- @patient.hole_cards.should == match.player.hole_cards
228
- @patient.actions_taken_this_hand.reject_empty_elements.should == match.player.actions_taken_this_hand.reject_empty_elements
225
+ @patient.name.must_equal match.player.name
226
+ @patient.seat.must_equal seat
227
+ @patient.hole_cards.must_equal match.player.hole_cards
228
+ @patient.actions_taken_this_hand.reject_empty_elements.must_equal match.player.actions_taken_this_hand.reject_empty_elements
229
229
 
230
- @patient.folded?.should == match.player.folded?
231
- @patient.all_in?.should == match.player.all_in?
232
- @patient.active?.should == match.player.active?
233
- @patient.round.should == match.current_hand.current_match_state.round
230
+ @patient.folded?.must_equal match.player.folded?
231
+ @patient.all_in?.must_equal match.player.all_in?
232
+ @patient.active?.must_equal match.player.active?
233
+ @patient.round.must_equal match.current_hand.current_match_state.round
234
234
  end
235
235
 
236
- @patient.chip_balance.should == match.player.chip_balance
236
+ @patient.chip_balance.must_equal match.player.chip_balance
237
237
  end
238
238
  end
239
239
  end
240
240
  end
241
241
 
242
242
  def check_patient
243
- @patient.name.should == @name
244
- @patient.seat.should == @seat
245
- @patient.chip_stack.should == @chip_stack
246
- @patient.chip_contributions.should == @chip_contributions
247
- @patient.chip_balance.should == @chip_balance
243
+ @patient.name.must_equal @name
244
+ @patient.seat.must_equal @seat
245
+ @patient.chip_stack.must_equal @chip_stack
246
+ @patient.chip_contributions.must_equal @chip_contributions
247
+ @patient.chip_balance.must_equal @chip_balance
248
248
  if @hole_cards
249
- (@patient.hole_cards.map { |card| card.to_s} ).should == @hole_cards.map { |card| card.to_s }
249
+ (@patient.hole_cards.map { |card| card.to_s} ).must_equal @hole_cards.map { |card| card.to_s }
250
250
  else
251
- @patient.hole_cards.should be nil
251
+ @patient.hole_cards.must_be_nil
252
252
  end
253
253
 
254
- @patient.actions_taken_this_hand.should == @actions_taken_this_hand
255
- @patient.folded?.should == @has_folded
256
- @patient.all_in?.should == @is_all_in
257
- @patient.active?.should == @is_active
258
- @patient.round.should == @round
254
+ @patient.actions_taken_this_hand.must_equal @actions_taken_this_hand
255
+ @patient.folded?.must_equal @has_folded
256
+ @patient.all_in?.must_equal @is_all_in
257
+ @patient.active?.must_equal @is_active
258
+ @patient.round.must_equal @round
259
259
  end
260
260
  def various_numbers_of_players
261
261
  (1..100).each do |number_of_players|
@@ -329,18 +329,18 @@ end
329
329
  end
330
330
  def instantiate_each_action_from_symbols(amount_to_put_in_pot=0,
331
331
  modifier=nil)
332
- PokerAction::LEGAL_SYMBOLS.each do |sym|
333
- modifier = if PokerAction::MODIFIABLE_ACTIONS.keys.include? sym
332
+ AcpcPokerTypes::PokerAction::LEGAL_SYMBOLS.each do |sym|
333
+ modifier = if AcpcPokerTypes::PokerAction::MODIFIABLE_ACTIONS.keys.include? sym
334
334
  modifier
335
335
  else
336
336
  nil
337
337
  end
338
338
 
339
- action = mock 'PokerAction'
339
+ action = mock 'AcpcPokerTypes::PokerAction'
340
340
  action.stubs(:to_sym).returns(sym)
341
341
  action.stubs(:to_s).returns(sym.to_s + modifier.to_s)
342
- action.stubs(:to_acpc).returns(PokerAction::LEGAL_ACTIONS[sym] + modifier.to_s)
343
- action.stubs(:to_acpc_character).returns(PokerAction::LEGAL_ACTIONS[sym])
342
+ action.stubs(:to_acpc).returns(AcpcPokerTypes::PokerAction::LEGAL_ACTIONS[sym] + modifier.to_s)
343
+ action.stubs(:to_acpc_character).returns(AcpcPokerTypes::PokerAction::LEGAL_ACTIONS[sym])
344
344
  action.stubs(:amount_to_put_in_pot).returns(amount_to_put_in_pot)
345
345
  action.stubs(:modifier).returns(modifier)
346
346
 
@@ -393,21 +393,21 @@ end
393
393
  end
394
394
  end
395
395
  def default_hand
396
- hidden_cards = Hand.new
396
+ hidden_cards = AcpcPokerTypes::Hand.new
397
397
 
398
398
  hidden_cards
399
399
  end
400
400
  def init_patient!
401
- @patient = Player.join_match @name, @seat, @chip_stack
401
+ @patient = AcpcPokerTypes::Player.join_match @name, @seat, @chip_stack
402
402
  end
403
- def init_new_hand_data!(type=nil)
403
+ def init_new_hand_data!
404
404
  @actions_taken_this_hand = [[]]
405
- init_new_hand_chip_data! type
405
+ init_new_hand_chip_data!
406
406
  end
407
- def init_new_hand_chip_data!(type=nil)
407
+ def init_new_hand_chip_data!
408
408
  # @todo Assumes Doyle's Game
409
- @chip_contributions = [if type then @blinds[@seat] else BLIND end]
409
+ @chip_contributions = [BLIND]
410
410
  @chip_balance = -@chip_contributions.first
411
- @chip_stack = (if type then DealerData::GAME_DEFS[type][:stack_size] else INITIAL_CHIP_STACK end) - @chip_contributions.first
411
+ @chip_stack = INITIAL_CHIP_STACK - @chip_contributions.first
412
412
  end
413
413
  end
@@ -2,50 +2,50 @@
2
2
  # Spec helper (must include first to track code coverage with SimpleCov)
3
3
  require File.expand_path('../support/spec_helper', __FILE__)
4
4
 
5
- require File.expand_path("#{LIB_ACPC_POKER_TYPES_PATH}/poker_action", __FILE__)
5
+ require 'acpc_poker_types/poker_action'
6
6
 
7
- describe PokerAction do
7
+ describe AcpcPokerTypes::PokerAction do
8
8
  describe 'legal actions can be retrieved' do
9
9
  it 'with ::LEGAL_ACTIONS' do
10
- PokerAction::LEGAL_ACTIONS.should_not be_empty
10
+ AcpcPokerTypes::PokerAction::LEGAL_ACTIONS.wont_be_empty
11
11
  end
12
12
 
13
13
  it 'in symbol format' do
14
- PokerAction::LEGAL_SYMBOLS.should_not be_empty
14
+ AcpcPokerTypes::PokerAction::LEGAL_SYMBOLS.wont_be_empty
15
15
  end
16
16
 
17
17
  it 'in string format' do
18
- PokerAction::LEGAL_STRINGS.should_not be_empty
18
+ AcpcPokerTypes::PokerAction::LEGAL_STRINGS.wont_be_empty
19
19
  end
20
20
 
21
21
  it 'in acpc format' do
22
- PokerAction::LEGAL_ACPC_CHARACTERS.should_not be_empty
22
+ AcpcPokerTypes::PokerAction::LEGAL_ACPC_CHARACTERS.wont_be_empty
23
23
  end
24
24
  end
25
25
 
26
26
  describe '#new' do
27
27
  it 'raises an exception if the given action is invalid' do
28
- expect{PokerAction.new(:not_an_action)}.to raise_exception(PokerAction::IllegalPokerAction)
28
+ ->{AcpcPokerTypes::PokerAction.new(:not_an_action)}.must_raise(AcpcPokerTypes::PokerAction::IllegalPokerAction)
29
29
  end
30
30
  it 'raises an exception if a modifier accompanies an unmodifiable action' do
31
- unmodifiable_actions = PokerAction::LEGAL_SYMBOLS - PokerAction::MODIFIABLE_ACTIONS.keys
31
+ unmodifiable_actions = AcpcPokerTypes::PokerAction::LEGAL_SYMBOLS - AcpcPokerTypes::PokerAction::MODIFIABLE_ACTIONS.keys
32
32
  unmodifiable_actions.each do |sym|
33
- expect{PokerAction.new(sym, {modifier: default_modifier})}.to raise_exception(PokerAction::IllegalPokerActionModification)
33
+ ->{AcpcPokerTypes::PokerAction.new(sym, {modifier: default_modifier})}.must_raise(AcpcPokerTypes::PokerAction::IllegalPokerActionModification)
34
34
  end
35
35
  end
36
36
  it 'raise an exception if a modifier is given both implicitly and explicitly' do
37
- expect{PokerAction.new('r9001', {modifier: default_modifier})}.to raise_exception(PokerAction::IllegalPokerActionModification)
37
+ ->{AcpcPokerTypes::PokerAction.new('r9001', {modifier: default_modifier})}.must_raise(AcpcPokerTypes::PokerAction::IllegalPokerActionModification)
38
38
  end
39
39
  it 'raise an exception if a fold action is given when no wager is seen by the acting player' do
40
- expect{PokerAction.new('f', {acting_player_sees_wager: false})}.to raise_exception(PokerAction::IllegalPokerAction)
40
+ ->{AcpcPokerTypes::PokerAction.new('f', {acting_player_sees_wager: false})}.must_raise(AcpcPokerTypes::PokerAction::IllegalPokerAction)
41
41
  end
42
42
  describe 'creates actions properly' do
43
43
  it 'from various forms' do
44
44
  various_amounts_to_put_in_pot do |amount|
45
45
  with_and_without_a_modifier do |modifier|
46
46
  instantiate_each_action_from_acpc_characters(amount, modifier) do |char, actual_modifier|
47
- check_patient_data PokerAction::LEGAL_ACTIONS.key(char),
48
- PokerAction::LEGAL_ACTIONS.key(char).to_s + actual_modifier.to_s,
47
+ check_patient_data AcpcPokerTypes::PokerAction::LEGAL_ACTIONS.key(char),
48
+ AcpcPokerTypes::PokerAction::LEGAL_ACTIONS.key(char).to_s + actual_modifier.to_s,
49
49
  char + actual_modifier.to_s,
50
50
  char,
51
51
  amount,
@@ -54,22 +54,22 @@ describe PokerAction do
54
54
  instantiate_each_action_from_strings(amount, modifier) do |string, actual_modifier|
55
55
  check_patient_data string.to_sym,
56
56
  string + actual_modifier.to_s,
57
- PokerAction::LEGAL_ACTIONS[string.to_sym] + actual_modifier.to_s,
58
- PokerAction::LEGAL_ACTIONS[string.to_sym],
57
+ AcpcPokerTypes::PokerAction::LEGAL_ACTIONS[string.to_sym] + actual_modifier.to_s,
58
+ AcpcPokerTypes::PokerAction::LEGAL_ACTIONS[string.to_sym],
59
59
  amount,
60
60
  actual_modifier
61
61
  end
62
62
  instantiate_each_action_from_symbols(amount, modifier) do |sym, actual_modifier|
63
63
  check_patient_data sym,
64
64
  sym.to_s + actual_modifier.to_s,
65
- PokerAction::LEGAL_ACTIONS[sym] + actual_modifier.to_s,
66
- PokerAction::LEGAL_ACTIONS[sym],
65
+ AcpcPokerTypes::PokerAction::LEGAL_ACTIONS[sym] + actual_modifier.to_s,
66
+ AcpcPokerTypes::PokerAction::LEGAL_ACTIONS[sym],
67
67
  amount,
68
68
  actual_modifier
69
69
  end
70
70
  instantiate_each_action_from_modified_acpc_characters(amount, modifier) do |char, actual_modifier|
71
- check_patient_data PokerAction::LEGAL_ACTIONS.key(char),
72
- PokerAction::LEGAL_ACTIONS.key(char).to_s + actual_modifier.to_s,
71
+ check_patient_data AcpcPokerTypes::PokerAction::LEGAL_ACTIONS.key(char),
72
+ AcpcPokerTypes::PokerAction::LEGAL_ACTIONS.key(char).to_s + actual_modifier.to_s,
73
73
  char + actual_modifier.to_s,
74
74
  char,
75
75
  amount,
@@ -78,8 +78,8 @@ describe PokerAction do
78
78
  instantiate_each_action_from_modified_strings(amount, modifier) do |string, actual_modifier|
79
79
  check_patient_data string.to_sym,
80
80
  string + actual_modifier.to_s,
81
- PokerAction::LEGAL_ACTIONS[string.to_sym] + actual_modifier.to_s,
82
- PokerAction::LEGAL_ACTIONS[string.to_sym],
81
+ AcpcPokerTypes::PokerAction::LEGAL_ACTIONS[string.to_sym] + actual_modifier.to_s,
82
+ AcpcPokerTypes::PokerAction::LEGAL_ACTIONS[string.to_sym],
83
83
  amount,
84
84
  actual_modifier
85
85
  end
@@ -90,25 +90,25 @@ describe PokerAction do
90
90
  end
91
91
  describe 'given knowledge that the acting player does not see a wager' do
92
92
  it 'properly changes the given action to its more precise form' do
93
- PokerAction::HIGH_RESOLUTION_ACTION_CONVERSION.each do |imprecise_action, precise_action|
93
+ AcpcPokerTypes::PokerAction::HIGH_RESOLUTION_ACTION_CONVERSION.each do |imprecise_action, precise_action|
94
94
  next if :fold == imprecise_action
95
- imprecise_action_character = PokerAction::LEGAL_ACTIONS[imprecise_action]
96
- precise_action_character = PokerAction::LEGAL_ACTIONS[precise_action]
97
- if PokerAction::MODIFIABLE_ACTIONS.values.include? imprecise_action_character
95
+ imprecise_action_character = AcpcPokerTypes::PokerAction::LEGAL_ACTIONS[imprecise_action]
96
+ precise_action_character = AcpcPokerTypes::PokerAction::LEGAL_ACTIONS[precise_action]
97
+ if AcpcPokerTypes::PokerAction::MODIFIABLE_ACTIONS.values.include? imprecise_action_character
98
98
  modifier = default_modifier
99
99
  expected_acpc_form = precise_action_character + modifier.to_s
100
100
  else
101
101
  modifier = nil
102
102
  expected_acpc_form = precise_action_character
103
103
  end
104
- PokerAction.new(imprecise_action_character, {modifier: modifier, acting_player_sees_wager: false}).to_acpc.should ==(expected_acpc_form)
104
+ AcpcPokerTypes::PokerAction.new(imprecise_action_character, {modifier: modifier, acting_player_sees_wager: false}).to_acpc.must_equal(expected_acpc_form)
105
105
  end
106
106
  end
107
107
  end
108
108
 
109
109
  def default_modifier
110
110
  modifier_amount = 9001
111
- modifier = mock 'ChipStack'
111
+ modifier = mock 'AcpcPokerTypes::ChipStack'
112
112
  modifier.stubs(:to_s).returns(modifier_amount.to_s)
113
113
  modifier
114
114
  end
@@ -128,78 +128,78 @@ describe PokerAction do
128
128
  expected_acpc_character,
129
129
  amount_to_put_in_pot=0,
130
130
  modifier=nil)
131
- @patient.to_sym.should be == expected_sym
132
- @patient.to_s.should be == expected_string
133
- @patient.to_acpc.should be == expected_acpc
134
- @patient.to_acpc_character.should be == expected_acpc_character
135
- @patient.amount_to_put_in_pot.should be == amount_to_put_in_pot
131
+ @patient.to_sym.must_equal expected_sym
132
+ @patient.to_s.must_equal expected_string
133
+ @patient.to_acpc.must_equal expected_acpc
134
+ @patient.to_acpc_character.must_equal expected_acpc_character
135
+ @patient.amount_to_put_in_pot.must_equal amount_to_put_in_pot
136
136
 
137
137
  has_modifier = !modifier.nil?
138
- @patient.has_modifier?.should be == has_modifier
138
+ @patient.has_modifier?.must_equal has_modifier
139
139
  end
140
140
  def instantiate_each_action_from_symbols(amount_to_put_in_pot=0,
141
141
  modifier=nil)
142
- PokerAction::LEGAL_SYMBOLS.each do |sym|
143
- modifier = if PokerAction::MODIFIABLE_ACTIONS.keys.include? sym
142
+ AcpcPokerTypes::PokerAction::LEGAL_SYMBOLS.each do |sym|
143
+ modifier = if AcpcPokerTypes::PokerAction::MODIFIABLE_ACTIONS.keys.include? sym
144
144
  modifier
145
145
  else
146
146
  nil
147
147
  end
148
148
 
149
- @patient = PokerAction.new(sym, {amount_to_put_in_pot: amount_to_put_in_pot, modifier: modifier})
149
+ @patient = AcpcPokerTypes::PokerAction.new(sym, {amount_to_put_in_pot: amount_to_put_in_pot, modifier: modifier})
150
150
  yield sym, modifier
151
151
  end
152
152
  end
153
153
  def instantiate_each_action_from_strings(amount_to_put_in_pot=0,
154
154
  modifier=nil)
155
- PokerAction::LEGAL_STRINGS.each do |string|
156
- modifier = if PokerAction::MODIFIABLE_ACTIONS.keys.include? string.to_sym
155
+ AcpcPokerTypes::PokerAction::LEGAL_STRINGS.each do |string|
156
+ modifier = if AcpcPokerTypes::PokerAction::MODIFIABLE_ACTIONS.keys.include? string.to_sym
157
157
  modifier
158
158
  else
159
159
  nil
160
160
  end
161
161
 
162
- @patient = PokerAction.new(string, {amount_to_put_in_pot: amount_to_put_in_pot, modifier: modifier})
162
+ @patient = AcpcPokerTypes::PokerAction.new(string, {amount_to_put_in_pot: amount_to_put_in_pot, modifier: modifier})
163
163
  yield string, modifier
164
164
  end
165
165
  end
166
166
  def instantiate_each_action_from_modified_strings(amount_to_put_in_pot=0,
167
167
  modifier=nil)
168
168
  unless modifier
169
- modifier = mock('ChipStack')
169
+ modifier = mock('AcpcPokerTypes::ChipStack')
170
170
  modifier.stubs(:to_s).returns('9001')
171
171
  end
172
- PokerAction::MODIFIABLE_ACTIONS.values.each do |char|
173
- string = PokerAction::LEGAL_ACTIONS.key(char).to_s
172
+ AcpcPokerTypes::PokerAction::MODIFIABLE_ACTIONS.values.each do |char|
173
+ string = AcpcPokerTypes::PokerAction::LEGAL_ACTIONS.key(char).to_s
174
174
  modified_action = string + modifier.to_s
175
175
 
176
- @patient = PokerAction.new(modified_action, {amount_to_put_in_pot: amount_to_put_in_pot})
176
+ @patient = AcpcPokerTypes::PokerAction.new(modified_action, {amount_to_put_in_pot: amount_to_put_in_pot})
177
177
  yield string, modifier
178
178
  end
179
179
  end
180
180
  def instantiate_each_action_from_acpc_characters(amount_to_put_in_pot=0,
181
181
  modifier=nil)
182
- PokerAction::LEGAL_ACPC_CHARACTERS.each do |char|
183
- modifier = if PokerAction::MODIFIABLE_ACTIONS.values.include? char
182
+ AcpcPokerTypes::PokerAction::LEGAL_ACPC_CHARACTERS.each do |char|
183
+ modifier = if AcpcPokerTypes::PokerAction::MODIFIABLE_ACTIONS.values.include? char
184
184
  modifier
185
185
  else
186
186
  nil
187
187
  end
188
188
 
189
- @patient = PokerAction.new(char, {amount_to_put_in_pot: amount_to_put_in_pot, modifier: modifier})
189
+ @patient = AcpcPokerTypes::PokerAction.new(char, {amount_to_put_in_pot: amount_to_put_in_pot, modifier: modifier})
190
190
  yield char, modifier
191
191
  end
192
192
  end
193
193
  def instantiate_each_action_from_modified_acpc_characters(amount_to_put_in_pot=0,
194
194
  modifier=nil)
195
195
  unless modifier
196
- modifier = mock('ChipStack')
196
+ modifier = mock('AcpcPokerTypes::ChipStack')
197
197
  modifier.stubs(:to_s).returns('9001')
198
198
  end
199
- PokerAction::MODIFIABLE_ACTIONS.values.each do |char|
199
+ AcpcPokerTypes::PokerAction::MODIFIABLE_ACTIONS.values.each do |char|
200
200
  modified_action = char + modifier.to_s
201
201
 
202
- @patient = PokerAction.new(modified_action, {amount_to_put_in_pot: amount_to_put_in_pot})
202
+ @patient = AcpcPokerTypes::PokerAction.new(modified_action, {amount_to_put_in_pot: amount_to_put_in_pot})
203
203
  yield char, modifier
204
204
  end
205
205
  end