acpc_poker_types 7.7.1 → 7.7.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4cf5ffad4ea43776a575dc0be0eaa6c13cd4d872
4
- data.tar.gz: 575b3b5dd27cdf6824e547aab132e03c19a5d17b
3
+ metadata.gz: bdfea85f6f2b2b796bedf4d2908e40e840d029f6
4
+ data.tar.gz: ded5cd67c1bfcaffd5623e89defe8d25572370a2
5
5
  SHA512:
6
- metadata.gz: 7df9f5b36f3d112561ab93ee04ebe59cb69bddc15352f04863ca680aba185af9463d8fe5fbf6007571393b0d80682dfbd3f7f0acfd0babbcc2d73bbec5baa232
7
- data.tar.gz: e97268914f445e120fc4aa56bb3b48e94c3076f9aa979ac6d512a37bdb81b140b135933b70b64710a4b1b003af476275fda473e241936432030ec286f4b64e6e
6
+ metadata.gz: 8d7329740b7ddd8e217fb9aebba88ee13e673ba2c60d536d7873fa837a0b2677009caf39e7f4184ac14cce1b35a98652e8b80f2b2e6ee96a3eda5202b1a26900
7
+ data.tar.gz: 27c04ec8f3b44a0e11ddd0ecc863d33eedb7be4b0b061f839215bd7c2be2bf77ed903150a19fc2b60390ac1d06f5c6af4c664cbf7697bc4d30b6a8295b7784a1
@@ -60,9 +60,13 @@ class MatchState < DelegateClass(String)
60
60
  attr_reader :winning_players
61
61
 
62
62
  # @return [Array<Float> or nil] The stack sizes at the beginning of the
63
- # current hand, or +nil+ if none were specified by the match state string.
63
+ # current hand or +nil+ if none were specified by the match state string.
64
64
  attr_reader :stack_sizes
65
65
 
66
+ # @return [String or nil] The comment appended to the end of the match state
67
+ # string or +nil+ if none was specified.
68
+ attr_reader :comment
69
+
66
70
  # @return [String] Label for match state strings.
67
71
  LABEL = 'MATCHSTATE'
68
72
 
@@ -108,10 +112,17 @@ class MatchState < DelegateClass(String)
108
112
  # @param [String] raw_match_state A raw match state string to be parsed.
109
113
  # @raise IncompleteMatchState
110
114
  def initialize(raw_match_state, previous_state = nil, game_def = nil)
111
- fields = raw_match_state.split(FIELD_SEPARATOR)[1..-1]
115
+ fields = raw_match_state.split(/(#{FIELD_SEPARATOR}|\s+#\s*)/)[1..-1]
116
+ fields.delete ':'
112
117
  @position_relative_to_dealer = fields.shift.to_i
113
118
  @hand_number = fields.shift.to_i
114
119
 
120
+ @comment = if fields[-2].count('#') > 0
121
+ comment = fields.pop
122
+ fields.pop
123
+ comment
124
+ end
125
+
115
126
  @stack_sizes = if (
116
127
  fields.length > 2 &&
117
128
  fields.first.count(HAND_SEPARATOR) > 0
@@ -1,3 +1,3 @@
1
1
  module AcpcPokerTypes
2
- VERSION = '7.7.1'
2
+ VERSION = '7.7.2'
3
3
  end
@@ -142,6 +142,25 @@ describe MatchState do
142
142
 
143
143
  test_match_state_success match_state
144
144
  end
145
+ it 'parses an initial match state that contains a comment' do
146
+ partial_match_state = MatchState::LABEL + ":0:22:"
147
+ betting = ''
148
+ community_cards = ''
149
+ hands = arbitrary_hole_card_hand.to_acpc + "|" + arbitrary_hole_card_hand.to_acpc
150
+
151
+ match_state = (
152
+ partial_match_state +
153
+ betting +
154
+ ":" +
155
+ hands +
156
+ community_cards
157
+ )
158
+ ms_with_comment = match_state + ' # comment'
159
+
160
+ patient = MatchState.parse ms_with_comment
161
+ patient.to_s.must_equal match_state
162
+ patient.comment.must_equal 'comment'
163
+ end
145
164
  end
146
165
 
147
166
  describe '#new allows bootstrapping from previous states' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acpc_poker_types
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.7.1
4
+ version: 7.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Morrill