acpc_poker_types 7.6.2 → 7.6.3

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: 4403a1cebfedd19fa7d8f866e93e24d25731ea3c
4
- data.tar.gz: e3c0547e54f123564e725c1a1709e85e0d0d4a45
3
+ metadata.gz: 2944d0bdc832b06182c3b558ca5ef3b71e1f5a7e
4
+ data.tar.gz: 0971d20c9269c2e564c6897ffbc5d2fe0397bd8c
5
5
  SHA512:
6
- metadata.gz: bb79a1f07b29c8b89de30cc86806c91131c93353679a4b2613c90e00c6ca2a6f32c215c7ecb4bd1f8fe81bca49afc53a31f7cbff710018fa30be2ed5a3ad0c12
7
- data.tar.gz: 89af2ce9ba13718f3e3ddd01d78484c72e2958e56aebbeba5fb9c4a3feebb5d6948aafe57df8ec3ee308b75bbf30c1f33fd22136f97a58586b1c0ac33e8b5853
6
+ metadata.gz: 25265d0602cf9029989f9e265268882a95ee081b1f7710d5eaa477cc8017df4c7ead651794f1f4230bac1830f9f75e69153619408a7c12bc3e2514fc2c1510e4
7
+ data.tar.gz: 195e8d55e00e9df7077cebe92cb1de72ec026053773d492d5886bc38938eb48b24b8575c636ef145f4ae1cfe948b79872c18274e6d456a1c5ce947521565fe39
data/Rakefile CHANGED
@@ -8,5 +8,5 @@ Rake::TestTask.new do |t|
8
8
  t.libs << "lib" << 'spec/support'
9
9
  t.test_files = FileList['spec/**/*_spec.rb']
10
10
  t.verbose = false
11
- t.warning = false
11
+ t.warning = true
12
12
  end
@@ -1,4 +1,4 @@
1
- require 'celluloid/autostart'
1
+ require 'celluloid/current'
2
2
 
3
3
  require 'acpc_poker_types/dealer_data/action_messages'
4
4
  require 'acpc_poker_types/dealer_data/hand_data'
@@ -39,6 +39,7 @@ class PokerMatchData
39
39
  dealer_directory,
40
40
  num_hands=nil
41
41
  )
42
+ Celluloid.boot
42
43
  parsed_action_messages = Celluloid::Future.new do
43
44
  DealerData::ActionMessages.parse_file(
44
45
  action_messages_file,
@@ -56,12 +57,15 @@ class PokerMatchData
56
57
  )
57
58
  end
58
59
 
59
- new(
60
+ instance = new(
60
61
  parsed_action_messages.value,
61
62
  parsed_hand_results.value,
62
63
  player_names,
63
64
  dealer_directory
64
65
  )
66
+ Celluloid.shutdown
67
+
68
+ instance
65
69
  end
66
70
 
67
71
  # @returns [DealerData::PokerMatchData]
@@ -72,6 +76,7 @@ class PokerMatchData
72
76
  dealer_directory,
73
77
  num_hands=nil
74
78
  )
79
+ Celluloid.boot
75
80
  parsed_action_messages = Celluloid::Future.new do
76
81
  DealerData::ActionMessages.parse(
77
82
  action_messages,
@@ -89,12 +94,16 @@ class PokerMatchData
89
94
  )
90
95
  end
91
96
 
92
- new(
97
+ instance = new(
93
98
  parsed_action_messages.value,
94
99
  parsed_hand_results.value,
95
100
  player_names,
96
101
  dealer_directory
97
102
  )
103
+
104
+ Celluloid.shutdown
105
+
106
+ instance
98
107
  end
99
108
 
100
109
  def initialize(
@@ -103,6 +112,8 @@ class PokerMatchData
103
112
  player_names,
104
113
  dealer_directory
105
114
  )
115
+ @hand_number = nil
116
+ @chip_distribution = nil
106
117
  if (
107
118
  parsed_action_messages.match_def.nil? ||
108
119
  parsed_hand_results.match_def.nil? ||
@@ -198,14 +209,7 @@ class PokerMatchData
198
209
 
199
210
  def next_turn!
200
211
  current_hand.next_turn!
201
-
202
- @players.each_with_index do |player, seat|
203
- last_match_state = current_hand.last_match_state(seat)
204
- match_state = current_hand.current_match_state(seat)
205
- end
206
-
207
212
  distribute_chips! if current_hand.final_turn?
208
-
209
213
  self
210
214
  end
211
215
 
@@ -367,4 +371,4 @@ class PokerMatchData
367
371
  end
368
372
  end
369
373
  end
370
- end
374
+ end
@@ -164,7 +164,19 @@ module AcpcPokerTypes
164
164
  class << self; alias_method(:parse, :new); end
165
165
 
166
166
  def initialize(definitions)
167
- initialize_members!
167
+ @raise_sizes = nil
168
+ @array = nil
169
+ @betting_type = BETTING_TYPES[:limit]
170
+ @number_of_players = MIN_VALUES[:@number_of_players]
171
+ @blinds = @number_of_players.times.inject([]) { |blinds, i| blinds << 0 }
172
+ @number_of_rounds = MIN_VALUES[:@number_of_rounds]
173
+ @number_of_board_cards = @number_of_rounds.times.inject([]) { |cards, i| cards << 0 }
174
+ @first_player_positions = self.class.default_first_player_positions @number_of_rounds
175
+ @max_number_of_wagers = self.class.default_max_number_of_wagers @number_of_rounds
176
+ @chip_stacks = self.class.default_chip_stacks @number_of_players
177
+ @number_of_suits = MIN_VALUES[:@number_of_suits]
178
+ @number_of_ranks = MIN_VALUES[:@number_of_ranks]
179
+ @number_of_hole_cards = MIN_VALUES[:@number_of_hole_cards]
168
180
 
169
181
  if definitions.is_a?(Hash)
170
182
  assign_definitions! definitions
@@ -227,22 +239,6 @@ module AcpcPokerTypes
227
239
 
228
240
  private
229
241
 
230
- def initialize_members!
231
- @betting_type = BETTING_TYPES[:limit]
232
- @number_of_players = MIN_VALUES[:@number_of_players]
233
- @blinds = @number_of_players.times.inject([]) { |blinds, i| blinds << 0 }
234
- @number_of_rounds = MIN_VALUES[:@number_of_rounds]
235
- @number_of_board_cards = @number_of_rounds.times.inject([]) { |cards, i| cards << 0 }
236
- @first_player_positions = self.class.default_first_player_positions @number_of_rounds
237
- @max_number_of_wagers = self.class.default_max_number_of_wagers @number_of_rounds
238
- @chip_stacks = self.class.default_chip_stacks @number_of_players
239
- @number_of_suits = MIN_VALUES[:@number_of_suits]
240
- @number_of_ranks = MIN_VALUES[:@number_of_ranks]
241
- @number_of_hole_cards = MIN_VALUES[:@number_of_hole_cards]
242
-
243
- self
244
- end
245
-
246
242
  def set_defintion_if_present!(definition_symbol, line, definition_label_in_line)
247
243
  new_definition = self.class.check_game_def_line_for_definition(
248
244
  line,
@@ -277,7 +273,6 @@ module AcpcPokerTypes
277
273
  next if (
278
274
  self.class.game_def_line_not_informative?(line) ||
279
275
  BETTING_TYPES.any? do |type_and_name|
280
- type = type_and_name.first
281
276
  name = type_and_name[1]
282
277
  if line.match(/\b#{name}\b/i)
283
278
  @betting_type = name
@@ -369,4 +364,4 @@ module AcpcPokerTypes
369
364
  end
370
365
  end
371
366
  end
372
- end
367
+ end
@@ -71,6 +71,7 @@ class PokerAction < DelegateClass(String)
71
71
  # @param cost [#to_f] The amount this action costs to the acting player.
72
72
  # @raise IllegalAction
73
73
  def initialize(action, modifier: nil, cost: 0)
74
+ @modifier = nil
74
75
  validate_action!(action, modifier.strip)
75
76
  @cost = cost.to_f
76
77
 
@@ -98,7 +99,7 @@ class PokerAction < DelegateClass(String)
98
99
 
99
100
  # @return [Boolean] +true+ if this action has a modifier, +false+ otherwise.
100
101
  def has_modifier?
101
- !@modifier.blank?
102
+ @modifier && !@modifier.blank?
102
103
  end
103
104
 
104
105
  private
@@ -157,9 +158,9 @@ class PokerAction < DelegateClass(String)
157
158
  end
158
159
 
159
160
  def validate_modifier
160
- unless @modifier.blank? || MODIFIABLE_ACTIONS.include?(@action)
161
+ unless @modifier.nil? || @modifier.blank? || MODIFIABLE_ACTIONS.include?(@action)
161
162
  raise(IllegalModification, "Illegal modifier: #{@modifier}")
162
163
  end
163
164
  end
164
165
  end
165
- end
166
+ end
@@ -1,3 +1,3 @@
1
1
  module AcpcPokerTypes
2
- VERSION = '7.6.2'
2
+ VERSION = '7.6.3'
3
3
  end
@@ -1,6 +1,10 @@
1
1
  # Spec helper (must include first to track code coverage with SimpleCov)
2
2
  require_relative '../support/spec_helper'
3
3
 
4
+ require 'celluloid/current'
5
+ require 'celluloid/test'
6
+ require 'celluloid/essentials'
7
+
4
8
  require 'mocha/setup'
5
9
 
6
10
  require 'acpc_dealer'
@@ -27,7 +31,6 @@ describe PokerMatchData do
27
31
  @no_chip_distribution = false
28
32
 
29
33
  if defined? Celluloid
30
- Celluloid.shutdown
31
34
  Celluloid.boot
32
35
  end
33
36
  end
@@ -35,7 +38,6 @@ describe PokerMatchData do
35
38
  after do
36
39
  if defined? Celluloid
37
40
  Celluloid.shutdown
38
- Celluloid.boot
39
41
  end
40
42
  end
41
43
 
@@ -86,8 +86,8 @@ describe GameDefinition do
86
86
 
87
87
  describe '#parse_file and #parse' do
88
88
  it "parses all available game definitions properly" do
89
- AcpcDealer::GAME_DEFINITION_FILE_PATHS.each do |key, groups_of_defs|
90
- groups_of_defs.each do |key, game_definition_file_name|
89
+ AcpcDealer::GAME_DEFINITION_FILE_PATHS.each do |_, groups_of_defs|
90
+ groups_of_defs.each do |_, game_definition_file_name|
91
91
  @patient = AcpcPokerTypes::GameDefinition.parse_file game_definition_file_name
92
92
 
93
93
  @expected = File.readlines(game_definition_file_name).map do |line|
@@ -3,18 +3,6 @@ require_relative 'support/spec_helper'
3
3
  require_relative "../lib/acpc_poker_types/hand_player_group"
4
4
  require_relative "../lib/acpc_poker_types/hand"
5
5
 
6
- module MapWithIndex
7
- refine Array do
8
- def map_with_index
9
- i = 0
10
- map do |elem|
11
- result = yield elem, i
12
- i += 1
13
- result
14
- end
15
- end
16
- end
17
- end
18
6
  using MapWithIndex
19
7
 
20
8
  include AcpcPokerTypes
@@ -47,4 +35,4 @@ describe HandPlayerGroup do
47
35
  def arbitrary_hole_card_hand
48
36
  Hand.from_acpc('AhKs')
49
37
  end
50
- end
38
+ end
@@ -11,18 +11,6 @@ require_relative "../lib/acpc_poker_types/card"
11
11
  require_relative "../lib/acpc_poker_types/game_definition"
12
12
  require_relative "../lib/acpc_poker_types/dealer_data/poker_match_data"
13
13
 
14
- module MapWithIndex
15
- refine Array do
16
- def map_with_index
17
- i = 0
18
- map do |elem|
19
- result = yield elem, i
20
- i += 1
21
- result
22
- end
23
- end
24
- end
25
- end
26
14
  using MapWithIndex
27
15
 
28
16
  include AcpcPokerTypes
@@ -152,22 +140,22 @@ describe MatchState do
152
140
  hands = [ Hand.new ]*game_def.number_of_players
153
141
  hands[position] = arbitrary_hole_card_hand
154
142
 
155
- hand_string = hands.inject('') do |hand_string, hand|
143
+ hand_string_ = hands.inject('') do |hand_string, hand|
156
144
  hand_string << "#{hand}#{MatchState::HAND_SEPARATOR}"
157
145
  end[0..-2]
158
146
 
159
147
  last_state = MatchState.new(
160
- "#{MatchState::LABEL}:#{position}:0:crcc/ccc/rr:#{hand_string}"
148
+ "#{MatchState::LABEL}:#{position}:0:crcc/ccc/rr:#{hand_string_}"
161
149
  )
162
150
 
163
151
  patient = MatchState.new(
164
- "#{MatchState::LABEL}:#{position}:0:crcc/ccc/rrf:#{hand_string}",
152
+ "#{MatchState::LABEL}:#{position}:0:crcc/ccc/rrf:#{hand_string_}",
165
153
  last_state,
166
154
  game_def
167
155
  )
168
156
 
169
157
  x_state = MatchState.new(
170
- "#{MatchState::LABEL}:#{position}:0:crcc/ccc/rrf:#{hand_string}"
158
+ "#{MatchState::LABEL}:#{position}:0:crcc/ccc/rrf:#{hand_string_}"
171
159
  )
172
160
 
173
161
  patient.betting_sequence(game_def).must_equal x_state.betting_sequence(game_def)
@@ -417,12 +405,12 @@ describe MatchState do
417
405
  (0..x_game_def.number_of_players-1).each do |position|
418
406
  hands = x_game_def.number_of_players.times.map { arbitrary_hole_card_hand }
419
407
 
420
- hand_string = hands.inject('') do |hand_string, hand|
408
+ hand_string_ = hands.inject('') do |hand_string, hand|
421
409
  hand_string << "#{hand}#{MatchState::HAND_SEPARATOR}"
422
410
  end[0..-2]
423
411
 
424
412
  match_state =
425
- "#{MatchState::LABEL}:#{position}:0:cr200cc///:#{hand_string}"
413
+ "#{MatchState::LABEL}:#{position}:0:cr200cc///:#{hand_string_}"
426
414
 
427
415
  MatchState.new(match_state).betting_sequence.must_equal(
428
416
  [
@@ -491,12 +479,12 @@ describe MatchState do
491
479
  hands = [ Hand.new ]*game_def.number_of_players
492
480
  hands[position] = arbitrary_hole_card_hand
493
481
 
494
- hand_string = hands.inject('') do |hand_string, hand|
482
+ hand_string_ = hands.inject('') do |hand_string, hand|
495
483
  hand_string << "#{hand}#{MatchState::HAND_SEPARATOR}"
496
484
  end[0..-2]
497
485
 
498
486
  patient = MatchState.parse(
499
- "#{MatchState::LABEL}:#{position}:0:crcc/ccc/rr:#{hand_string}"
487
+ "#{MatchState::LABEL}:#{position}:0:crcc/ccc/rr:#{hand_string_}"
500
488
  )
501
489
 
502
490
  patient.betting_sequence.must_equal [
@@ -548,12 +536,12 @@ describe MatchState do
548
536
 
549
537
  hands[position] = arbitrary_hole_card_hand
550
538
 
551
- hand_string = hands.inject('') do |hand_string, hand|
539
+ hand_string_ = hands.inject('') do |hand_string, hand|
552
540
  hand_string << "#{hand}#{MatchState::HAND_SEPARATOR}"
553
541
  end[0..-2]
554
542
 
555
543
  match_state =
556
- "#{MatchState::LABEL}:#{position}:0:crcc/ccc/rrfc:#{hand_string}"
544
+ "#{MatchState::LABEL}:#{position}:0:crcc/ccc/rrfc:#{hand_string_}"
557
545
 
558
546
  MatchState.new(
559
547
  match_state
@@ -656,12 +644,12 @@ describe MatchState do
656
644
 
657
645
  hands[position] = arbitrary_hole_card_hand
658
646
 
659
- hand_string = hands.inject('') do |hand_string, hand|
647
+ hand_string_ = hands.inject('') do |hand_string, hand|
660
648
  hand_string << "#{hand}#{MatchState::HAND_SEPARATOR}"
661
649
  end[0..-2]
662
650
 
663
651
  match_state =
664
- "#{MatchState::LABEL}:#{position}:0:crcc/ccc/rrfc/crc:#{hand_string}"
652
+ "#{MatchState::LABEL}:#{position}:0:crcc/ccc/rrfc/crc:#{hand_string_}"
665
653
 
666
654
  MatchState.new(match_state).every_action(x_game_def) do |action, round, acting_player_position|
667
655
  x_yields = x_actions.shift
@@ -736,12 +724,12 @@ describe MatchState do
736
724
  Hand.from_acpc "Ac#{i+2}h"
737
725
  end
738
726
 
739
- hand_string = hands.inject('') do |hand_string, hand|
727
+ hand_string_ = hands.inject('') do |hand_string, hand|
740
728
  hand_string << "#{hand}#{MatchState::HAND_SEPARATOR}"
741
729
  end[0..-2]
742
730
 
743
731
  match_state =
744
- "#{MatchState::LABEL}:#{position}:0:crcc/ccc/rrfc:#{hand_string}"
732
+ "#{MatchState::LABEL}:#{position}:0:crcc/ccc/rrfc:#{hand_string_}"
745
733
 
746
734
  MatchState.new(
747
735
  match_state
@@ -777,12 +765,12 @@ describe MatchState do
777
765
  Hand.from_acpc "Ac#{i+2}h"
778
766
  end
779
767
 
780
- hand_string = hands.inject('') do |hand_string, hand|
768
+ hand_string_ = hands.inject('') do |hand_string, hand|
781
769
  hand_string << "#{hand}#{MatchState::HAND_SEPARATOR}"
782
770
  end[0..-2]
783
771
 
784
772
  match_state =
785
- "#{MatchState::LABEL}:#{position}:0:crcc/ccc/rrcc/crcc:#{hand_string}"
773
+ "#{MatchState::LABEL}:#{position}:0:crcc/ccc/rrcc/crcc:#{hand_string_}"
786
774
 
787
775
  MatchState.new(match_state).players(x_game_def).each_with_index do |player, i|
788
776
  player.winnings.must_equal x_winnings[i]
@@ -811,12 +799,12 @@ describe MatchState do
811
799
  Hand.from_acpc "Ac2#{['s', 'h', 'd', 'c'][i%4]}"
812
800
  end
813
801
 
814
- hand_string = hands.inject('') do |hand_string, hand|
802
+ hand_string_ = hands.inject('') do |hand_string, hand|
815
803
  hand_string << "#{hand}#{MatchState::HAND_SEPARATOR}"
816
804
  end[0..-2]
817
805
 
818
806
  match_state =
819
- "#{MatchState::LABEL}:#{position}:0:crcc/ccc/rrfc/crc:#{hand_string}"
807
+ "#{MatchState::LABEL}:#{position}:0:crcc/ccc/rrfc/crc:#{hand_string_}"
820
808
 
821
809
  MatchState.new(match_state).players(x_game_def).each_with_index do |player, i|
822
810
  player.winnings.must_equal x_winnings[i]
@@ -845,12 +833,12 @@ describe MatchState do
845
833
 
846
834
  hands[position] = arbitrary_hole_card_hand
847
835
 
848
- hand_string = hands.inject('') do |hand_string, hand|
836
+ hand_string_ = hands.inject('') do |hand_string, hand|
849
837
  hand_string << "#{hand}#{MatchState::HAND_SEPARATOR}"
850
838
  end[0..-2]
851
839
 
852
840
  match_state =
853
- "#{MatchState::LABEL}:#{position}:0:crcc/ccc/rrff:#{hand_string}"
841
+ "#{MatchState::LABEL}:#{position}:0:crcc/ccc/rrff:#{hand_string_}"
854
842
 
855
843
  MatchState.new(match_state).players(x_game_def).each_with_index do |player, i|
856
844
  player.winnings.must_equal x_winnings[i]
@@ -896,12 +884,12 @@ describe MatchState do
896
884
  Hand.from_acpc "Ac2#{['s', 'h', 'd', 'c'][i%4]}"
897
885
  end
898
886
 
899
- hand_string = hands.inject('') do |hand_string, hand|
887
+ hand_string_ = hands.inject('') do |hand_string, hand|
900
888
  hand_string << "#{hand}#{MatchState::HAND_SEPARATOR}"
901
889
  end[0..-2]
902
890
 
903
891
  match_state =
904
- "#{MatchState::LABEL}:#{position}:0:crcc/ccc/rrfc/crc:#{hand_string}"
892
+ "#{MatchState::LABEL}:#{position}:0:crcc/ccc/rrfc/crc:#{hand_string_}"
905
893
 
906
894
  MatchState.new(match_state).pot(x_game_def).must_equal x_total_contributions.inject(:+)
907
895
  end
@@ -923,12 +911,12 @@ describe MatchState do
923
911
 
924
912
  hands[position] = arbitrary_hole_card_hand
925
913
 
926
- hand_string = hands.inject('') do |hand_string, hand|
914
+ hand_string_ = hands.inject('') do |hand_string, hand|
927
915
  hand_string << "#{hand}#{MatchState::HAND_SEPARATOR}"
928
916
  end[0..-2]
929
917
 
930
918
  match_state =
931
- "#{MatchState::LABEL}:#{position}:0:crcc/ccc/rrfc/crc:#{hand_string}"
919
+ "#{MatchState::LABEL}:#{position}:0:crcc/ccc/rrfc/crc:#{hand_string_}"
932
920
 
933
921
  MatchState.new(match_state).player_acting_sequence(x_game_def).must_equal(
934
922
  [[2, 0, 1, 2], [1, 2, 0], [1, 2, 0, 1], [1, 2, 1]]
@@ -948,12 +936,12 @@ describe MatchState do
948
936
  (0..x_game_def.number_of_players-1).each do |position|
949
937
  hands = x_game_def.number_of_players.times.map { arbitrary_hole_card_hand }
950
938
 
951
- hand_string = hands.inject('') do |hand_string, hand|
939
+ hand_string_ = hands.inject('') do |hand_string, hand|
952
940
  hand_string << "#{hand}#{MatchState::HAND_SEPARATOR}"
953
941
  end[0..-2]
954
942
 
955
943
  match_state =
956
- "#{MatchState::LABEL}:#{position}:0:cr200cc///:#{hand_string}"
944
+ "#{MatchState::LABEL}:#{position}:0:cr200cc///:#{hand_string_}"
957
945
 
958
946
  MatchState.new(match_state).player_acting_sequence(x_game_def).must_equal(
959
947
  [[2, 0, 1, 2], [], [], []]
@@ -977,12 +965,12 @@ describe MatchState do
977
965
  Hand.from_acpc "Ac#{i+2}h"
978
966
  end
979
967
 
980
- hand_string = hands.inject('') do |hand_string, hand|
968
+ hand_string_ = hands.inject('') do |hand_string, hand|
981
969
  hand_string << "#{hand}#{MatchState::HAND_SEPARATOR}"
982
970
  end[0..-2]
983
971
 
984
972
  match_state =
985
- "#{MatchState::LABEL}:#{position}:0:crcc/ccc/rrfc/crc:#{hand_string}"
973
+ "#{MatchState::LABEL}:#{position}:0:crcc/ccc/rrfc/crc:#{hand_string_}"
986
974
 
987
975
  MatchState.new(match_state).hand_ended?(x_game_def).must_equal true
988
976
  end
@@ -1002,12 +990,12 @@ describe MatchState do
1002
990
 
1003
991
  hands[position] = arbitrary_hole_card_hand
1004
992
 
1005
- hand_string = hands.inject('') do |hand_string, hand|
993
+ hand_string_ = hands.inject('') do |hand_string, hand|
1006
994
  hand_string << "#{hand}#{MatchState::HAND_SEPARATOR}"
1007
995
  end[0..-2]
1008
996
 
1009
997
  match_state =
1010
- "#{MatchState::LABEL}:#{position}:0:crcc/ccc/rrfc/cr:#{hand_string}"
998
+ "#{MatchState::LABEL}:#{position}:0:crcc/ccc/rrfc/cr:#{hand_string_}"
1011
999
 
1012
1000
  MatchState.new(match_state).hand_ended?(x_game_def).must_equal false
1013
1001
  end
@@ -1027,12 +1015,12 @@ describe MatchState do
1027
1015
 
1028
1016
  hands[position] = arbitrary_hole_card_hand
1029
1017
 
1030
- hand_string = hands.inject('') do |hand_string, hand|
1018
+ hand_string_ = hands.inject('') do |hand_string, hand|
1031
1019
  hand_string << "#{hand}#{MatchState::HAND_SEPARATOR}"
1032
1020
  end[0..-2]
1033
1021
 
1034
1022
  match_state =
1035
- "#{MatchState::LABEL}:#{position}:0:crcc/ccc/rrff:#{hand_string}"
1023
+ "#{MatchState::LABEL}:#{position}:0:crcc/ccc/rrff:#{hand_string_}"
1036
1024
 
1037
1025
  MatchState.new(match_state).hand_ended?(x_game_def).must_equal true
1038
1026
  end
@@ -1052,12 +1040,12 @@ describe MatchState do
1052
1040
 
1053
1041
  hands[position] = arbitrary_hole_card_hand
1054
1042
 
1055
- hand_string = hands.inject('') do |hand_string, hand|
1043
+ hand_string_ = hands.inject('') do |hand_string, hand|
1056
1044
  hand_string << "#{hand}#{MatchState::HAND_SEPARATOR}"
1057
1045
  end[0..-2]
1058
1046
 
1059
1047
  match_state =
1060
- "#{MatchState::LABEL}:#{position}:0:cr200:#{hand_string}"
1048
+ "#{MatchState::LABEL}:#{position}:0:cr200:#{hand_string_}"
1061
1049
 
1062
1050
  MatchState.new(match_state).hand_ended?(x_game_def).must_equal false
1063
1051
  end
@@ -1075,12 +1063,12 @@ describe MatchState do
1075
1063
  (0..x_game_def.number_of_players-1).each do |position|
1076
1064
  hands = x_game_def.number_of_players.times.map { arbitrary_hole_card_hand }
1077
1065
 
1078
- hand_string = hands.inject('') do |hand_string, hand|
1066
+ hand_string_ = hands.inject('') do |hand_string, hand|
1079
1067
  hand_string << "#{hand}#{MatchState::HAND_SEPARATOR}"
1080
1068
  end[0..-2]
1081
1069
 
1082
1070
  match_state =
1083
- "#{MatchState::LABEL}:#{position}:0:cr200cc///:#{hand_string}"
1071
+ "#{MatchState::LABEL}:#{position}:0:cr200cc///:#{hand_string_}"
1084
1072
 
1085
1073
  MatchState.new(match_state).hand_ended?(x_game_def).must_equal true
1086
1074
  end
@@ -1105,13 +1093,13 @@ describe MatchState do
1105
1093
  actions_per_round.each_with_index do |action, j|
1106
1094
  actions << action
1107
1095
 
1108
- hands = x_game_def.number_of_players.times.map { |i| "Ac#{i+2}h" }
1096
+ hands = x_game_def.number_of_players.times.map { |k| "Ac#{k+2}h" }
1109
1097
 
1110
- hand_string = hands.inject('') do |string, hand|
1098
+ hand_string_ = hands.inject('') do |string, hand|
1111
1099
  string << "#{hand}#{MatchState::HAND_SEPARATOR}"
1112
1100
  end[0..-2]
1113
1101
 
1114
- match_state = "#{MatchState::LABEL}:#{position}:0:#{actions}:#{hand_string}"
1102
+ match_state = "#{MatchState::LABEL}:#{position}:0:#{actions}:#{hand_string_}"
1115
1103
 
1116
1104
  MatchState.new(match_state).min_wager_by(x_game_def).must_equal x_min_wagers[i][j]
1117
1105
  end
@@ -1277,7 +1265,6 @@ describe MatchState do
1277
1265
  game_definition
1278
1266
  )
1279
1267
 
1280
- blind = 100
1281
1268
  to_all_in = game_definition.chip_stacks[0] - 9550
1282
1269
 
1283
1270
  x_actions = [
@@ -1337,4 +1324,4 @@ end
1337
1324
 
1338
1325
  def arbitrary_hole_card_hand
1339
1326
  Hand.from_acpc('2s3h')
1340
- end
1327
+ end
@@ -49,8 +49,9 @@ describe AcpcPokerTypes::PokerAction do
49
49
  end
50
50
  end
51
51
  it 'when the cost is negative' do
52
+ negative_cost = -DEFAULT_COST
52
53
  AcpcPokerTypes::PokerAction::ACTIONS.each do |a|
53
- AcpcPokerTypes::PokerAction.new(a, cost: -DEFAULT_COST).cost.must_equal -DEFAULT_COST
54
+ AcpcPokerTypes::PokerAction.new(a, cost: negative_cost).cost.must_equal negative_cost
54
55
  end
55
56
  end
56
57
  end
@@ -124,4 +125,4 @@ describe AcpcPokerTypes::PokerAction do
124
125
  end
125
126
  end
126
127
  end
127
- end
128
+ end
@@ -1,12 +1,10 @@
1
1
  require 'simplecov'
2
2
  SimpleCov.start
3
+ $LOAD_PATH.unshift File.expand_path('../../../lib', __FILE__)
3
4
 
4
5
  require 'minitest/autorun'
5
6
  require 'minitest/spec'
6
7
 
7
- require 'celluloid/autostart'
8
- require 'celluloid/test'
9
-
10
8
  begin
11
9
  require 'awesome_print'
12
10
  module Minitest::Assertions
@@ -19,6 +17,19 @@ begin
19
17
  rescue LoadError
20
18
  end
21
19
 
20
+ module MapWithIndex
21
+ refine Array do
22
+ def map_with_index
23
+ i = 0
24
+ map do |elem|
25
+ result = yield elem, i
26
+ i += 1
27
+ result
28
+ end
29
+ end
30
+ end
31
+ end
32
+
22
33
  # Match log information in dealer_logs
23
34
  class MatchLog
24
35
  DEALER_LOG_DIRECTORY = File.expand_path('../dealer_logs', __FILE__)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acpc_poker_types
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.6.2
4
+ version: 7.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Morrill
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-16 00:00:00.000000000 Z
11
+ date: 2016-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: process_runner
@@ -221,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
221
221
  version: '0'
222
222
  requirements: []
223
223
  rubyforge_project:
224
- rubygems_version: 2.2.2
224
+ rubygems_version: 2.5.1
225
225
  signing_key:
226
226
  specification_version: 4
227
227
  summary: ACPC Poker Types