acpc_poker_types 7.7.0 → 7.7.1

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: 440988b04d147e8ebd36f811f4d8c367c13a7972
4
- data.tar.gz: 7792be06237f5dfb81ce0a26caf7daae4de70bec
3
+ metadata.gz: 4cf5ffad4ea43776a575dc0be0eaa6c13cd4d872
4
+ data.tar.gz: 575b3b5dd27cdf6824e547aab132e03c19a5d17b
5
5
  SHA512:
6
- metadata.gz: 8cd0412d181f98f897cf169be1eb70a312f0c3adb922eb44aaa6839b9e04459ec5b0eb4aee614d39ae566dadbab030ea9e54eaf58a9465c09eee3ca3671763d4
7
- data.tar.gz: 834f4b9d84959c1917dfe1b1ebe7a7c8ba28612696268d0a3288794368adb341c0ca65e1580eb2d63cdb0cc2f50d8696df04f3f0e8b12363f3e8bd6efca1fba2
6
+ metadata.gz: 7df9f5b36f3d112561ab93ee04ebe59cb69bddc15352f04863ca680aba185af9463d8fe5fbf6007571393b0d80682dfbd3f7f0acfd0babbcc2d73bbec5baa232
7
+ data.tar.gz: e97268914f445e120fc4aa56bb3b48e94c3076f9aa979ac6d512a37bdb81b140b135933b70b64710a4b1b003af476275fda473e241936432030ec286f4b64e6e
@@ -59,6 +59,10 @@ class MatchState < DelegateClass(String)
59
59
 
60
60
  attr_reader :winning_players
61
61
 
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.
64
+ attr_reader :stack_sizes
65
+
62
66
  # @return [String] Label for match state strings.
63
67
  LABEL = 'MATCHSTATE'
64
68
 
@@ -92,28 +96,32 @@ class MatchState < DelegateClass(String)
92
96
  board_cards,
93
97
  stack_sizes = nil
94
98
  )
95
- string = "#{LABEL}#{FIELD_SEPARATOR}#{position_relative_to_dealer}#{FIELD_SEPARATOR}#{hand_number}#{FIELD_SEPARATOR}#{betting_sequence}#{FIELD_SEPARATOR}#{all_hole_cards}"
96
- string << "/#{board_cards.to_s}" if board_cards && !board_cards.empty?
99
+ string = "#{LABEL}#{FIELD_SEPARATOR}#{position_relative_to_dealer}#{FIELD_SEPARATOR}#{hand_number}"
97
100
  if stack_sizes
98
101
  string << "#{FIELD_SEPARATOR}#{stack_sizes.map { |stack| format('%g', stack) }.join('|')}"
99
102
  end
103
+ string << "#{FIELD_SEPARATOR}#{betting_sequence}#{FIELD_SEPARATOR}#{all_hole_cards}"
104
+ string << "/#{board_cards.to_s}" if board_cards && !board_cards.empty?
100
105
  string
101
106
  end
102
107
 
103
108
  # @param [String] raw_match_state A raw match state string to be parsed.
104
109
  # @raise IncompleteMatchState
105
110
  def initialize(raw_match_state, previous_state = nil, game_def = nil)
106
- fields = raw_match_state.split(FIELD_SEPARATOR)
107
- @position_relative_to_dealer = fields[1].to_i
108
- @hand_number = fields[2].to_i
109
- @betting_sequence_string = fields[3]
110
- card_fields = fields[4].split(COMMUNITY_CARD_SEPARATOR)
111
+ fields = raw_match_state.split(FIELD_SEPARATOR)[1..-1]
112
+ @position_relative_to_dealer = fields.shift.to_i
113
+ @hand_number = fields.shift.to_i
114
+
115
+ @stack_sizes = if (
116
+ fields.length > 2 &&
117
+ fields.first.count(HAND_SEPARATOR) > 0
118
+ ) then fields.shift.split(HAND_SEPARATOR).map(&:to_f) end
119
+
120
+ @betting_sequence_string = fields.shift
121
+
122
+ card_fields = fields.shift.split(COMMUNITY_CARD_SEPARATOR)
111
123
  @hands_string = card_fields.shift
112
124
  @community_cards_string = card_fields.join('/')
113
- @stack_sizes = nil
114
- if fields.length > 5 && fields[5].count(HAND_SEPARATOR) > 0
115
- @stack_sizes = fields[5].split(HAND_SEPARATOR).map(&:to_f)
116
- end
117
125
 
118
126
  @winning_players = nil
119
127
  @str = nil
@@ -1,3 +1,3 @@
1
1
  module AcpcPokerTypes
2
- VERSION = '7.7.0'
2
+ VERSION = '7.7.1'
3
3
  end
@@ -130,10 +130,15 @@ describe MatchState do
130
130
 
131
131
  stacks = [9001, 222]
132
132
 
133
- match_state = partial_match_state + betting + ":" + hands + community_cards + ":" + stacks.map(&:to_s).join('|')
134
-
135
- patient = MatchState.parse match_state
136
- ap patient: patient.to_s, match_state: match_state
133
+ match_state = (
134
+ partial_match_state +
135
+ stacks.map(&:to_s).join('|') +
136
+ ":" +
137
+ betting +
138
+ ":" +
139
+ hands +
140
+ community_cards
141
+ )
137
142
 
138
143
  test_match_state_success match_state
139
144
  end
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.7.0
4
+ version: 7.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Morrill
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-27 00:00:00.000000000 Z
11
+ date: 2017-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: process_runner