acpc_poker_types 3.1.4 → 3.2.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.
- checksums.yaml +4 -4
- data/lib/acpc_poker_types/match_state.rb +7 -0
- data/lib/acpc_poker_types/version.rb +1 -1
- data/spec/coverage/index.html +1 -1
- data/spec/match_state_spec.rb +26 -0
- data/spec/player_spec.rb +6 -37
- data/spec/support/spec_helper.rb +46 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bfe40c1a733d3678c62f4de63c649864408ca8ff
|
4
|
+
data.tar.gz: 75758c743dcdac65039dd7b369dcfe0f15dd2f94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 840f979748a1d5bb9dff3ea26371f807835cb36a2179eee010929e786fa6fc16571a070c84a6ba0d8d3254f16f774447fa40520c3e75847c39705740a2c596bb
|
7
|
+
data.tar.gz: 5463e698ad55cf608f8f79400b89015c030868ea80afdfca645efefa1a1d88e90d4e9bd63ffefd5ca5cd818d1902c5c0dc26b1f9eb42d22fef363db7c8482609
|
@@ -41,6 +41,13 @@ module AcpcPokerTypes
|
|
41
41
|
|
42
42
|
class << self; alias_method(:parse, :new) end
|
43
43
|
|
44
|
+
# Receives a match state string from the given +connection+.
|
45
|
+
# @param [#gets] connection The connection from which a match state string should be received.
|
46
|
+
# @return [MatchState] The match state string that was received from the +connection+ or +nil+ if none could be received.
|
47
|
+
def self.receive(connection)
|
48
|
+
AcpcPokerTypes::MatchState.parse connection.gets
|
49
|
+
end
|
50
|
+
|
44
51
|
# Builds a match state string from its given component parts.
|
45
52
|
#
|
46
53
|
# @param [#to_s] position_relative_to_dealer The position relative to the dealer.
|
data/spec/coverage/index.html
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
<img src="./assets/0.7.1/loading.gif" alt="loading"/>
|
15
15
|
</div>
|
16
16
|
<div id="wrapper" style="display:none;">
|
17
|
-
<div class="timestamp">Generated <abbr class="timeago" title="2013-05-
|
17
|
+
<div class="timestamp">Generated <abbr class="timeago" title="2013-05-16T14:10:19-06:00">2013-05-16T14:10:19-06:00</abbr></div>
|
18
18
|
<ul class="group_tabs"></ul>
|
19
19
|
|
20
20
|
<div id="content">
|
data/spec/match_state_spec.rb
CHANGED
@@ -2,12 +2,15 @@
|
|
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 'acpc_dealer'
|
6
|
+
|
5
7
|
require "acpc_poker_types/match_state"
|
6
8
|
require "acpc_poker_types/poker_action"
|
7
9
|
require "acpc_poker_types/rank"
|
8
10
|
require "acpc_poker_types/suit"
|
9
11
|
require "acpc_poker_types/hand"
|
10
12
|
require "acpc_poker_types/card"
|
13
|
+
require 'acpc_poker_types/acpc_dealer_data/poker_match_data'
|
11
14
|
|
12
15
|
describe AcpcPokerTypes::MatchState do
|
13
16
|
describe '#parse' do
|
@@ -213,6 +216,29 @@ describe AcpcPokerTypes::MatchState do
|
|
213
216
|
end
|
214
217
|
end
|
215
218
|
end
|
219
|
+
describe "#receive_matchstate_string" do
|
220
|
+
it 'receives matchstate strings properly' do
|
221
|
+
@connection = mock 'Socket'
|
222
|
+
MatchLog.all.each do |log_description|
|
223
|
+
match = AcpcPokerTypes::AcpcDealerData::PokerMatchData.parse_files(
|
224
|
+
log_description.actions_file_path,
|
225
|
+
log_description.results_file_path,
|
226
|
+
log_description.player_names,
|
227
|
+
AcpcDealer::DEALER_DIRECTORY,
|
228
|
+
20
|
229
|
+
)
|
230
|
+
match.for_every_seat! do |seat|
|
231
|
+
match.for_every_hand! do
|
232
|
+
match.for_every_turn! do
|
233
|
+
@connection.expects(:gets).returns(match.current_hand.current_match_state.to_s)
|
234
|
+
|
235
|
+
AcpcPokerTypes::MatchState.receive(@connection).must_equal match.current_hand.current_match_state
|
236
|
+
end
|
237
|
+
end
|
238
|
+
end
|
239
|
+
end
|
240
|
+
end
|
241
|
+
end
|
216
242
|
|
217
243
|
def for_every_card
|
218
244
|
AcpcPokerTypes::Rank::DOMAIN.map do |rank, rank_properties|
|
data/spec/player_spec.rb
CHANGED
@@ -179,7 +179,7 @@ describe AcpcPokerTypes::Player do
|
|
179
179
|
end
|
180
180
|
it 'works properly over samples of data from the ACPC Dealer' do
|
181
181
|
dealer_log_directory = File.expand_path('../support/dealer_logs', __FILE__)
|
182
|
-
|
182
|
+
MatchLog.all.each do |log_description|
|
183
183
|
match = AcpcPokerTypes::AcpcDealerData::PokerMatchData.parse_files(
|
184
184
|
"#{dealer_log_directory}/#{log_description.actions_file_name}",
|
185
185
|
"#{dealer_log_directory}/#{log_description.results_file_name}",
|
@@ -260,44 +260,13 @@ describe AcpcPokerTypes::Player do
|
|
260
260
|
end
|
261
261
|
end
|
262
262
|
|
263
|
-
class Array
|
264
|
-
|
265
|
-
|
266
|
-
|
263
|
+
class Array
|
264
|
+
def reject_empty_elements
|
265
|
+
reject do |elem|
|
266
|
+
elem.empty?
|
267
|
+
end
|
267
268
|
end
|
268
269
|
end
|
269
|
-
end
|
270
|
-
|
271
|
-
MatchLog = Struct.new(
|
272
|
-
:results_file_name,
|
273
|
-
:actions_file_name,
|
274
|
-
:player_names
|
275
|
-
)
|
276
|
-
|
277
|
-
def match_logs
|
278
|
-
[
|
279
|
-
MatchLog.new(
|
280
|
-
'2p.limit.h1000.r0.log',
|
281
|
-
'2p.limit.h1000.r0.actions.log',
|
282
|
-
['p1', 'p2']
|
283
|
-
),
|
284
|
-
MatchLog.new(
|
285
|
-
'2p.nolimit.h1000.r0.log',
|
286
|
-
'2p.nolimit.h1000.r0.actions.log',
|
287
|
-
['p1', 'p2']
|
288
|
-
),
|
289
|
-
MatchLog.new(
|
290
|
-
'3p.limit.h1000.r0.log',
|
291
|
-
'3p.limit.h1000.r0.actions.log',
|
292
|
-
['p1', 'p2', 'p3']
|
293
|
-
),
|
294
|
-
MatchLog.new(
|
295
|
-
'3p.nolimit.h1000.r0.log',
|
296
|
-
'3p.nolimit.h1000.r0.actions.log',
|
297
|
-
['p1', 'p2', 'p3']
|
298
|
-
)
|
299
|
-
]
|
300
|
-
end
|
301
270
|
|
302
271
|
def various_actions
|
303
272
|
various_amounts_to_put_in_pot do |amount|
|
data/spec/support/spec_helper.rb
CHANGED
@@ -2,7 +2,6 @@ require 'simplecov'
|
|
2
2
|
SimpleCov.start
|
3
3
|
|
4
4
|
require 'minitest/spec'
|
5
|
-
require 'minitest/pride'
|
6
5
|
|
7
6
|
begin
|
8
7
|
require 'turn'
|
@@ -30,4 +29,50 @@ begin
|
|
30
29
|
require 'pry-rescue/minitest'
|
31
30
|
require 'mocha/setup'
|
32
31
|
rescue LoadError
|
32
|
+
end
|
33
|
+
|
34
|
+
# Match log information in dealer_logs
|
35
|
+
class MatchLog
|
36
|
+
DEALER_LOG_DIRECTORY = File.expand_path('../dealer_logs', __FILE__)
|
37
|
+
|
38
|
+
attr_reader :results_file_name, :actions_file_name, :player_names, :dealer_log_directory
|
39
|
+
|
40
|
+
def self.all
|
41
|
+
[
|
42
|
+
MatchLog.new(
|
43
|
+
'2p.limit.h1000.r0.log',
|
44
|
+
'2p.limit.h1000.r0.actions.log',
|
45
|
+
['p1', 'p2']
|
46
|
+
),
|
47
|
+
MatchLog.new(
|
48
|
+
'2p.nolimit.h1000.r0.log',
|
49
|
+
'2p.nolimit.h1000.r0.actions.log',
|
50
|
+
['p1', 'p2']
|
51
|
+
),
|
52
|
+
MatchLog.new(
|
53
|
+
'3p.limit.h1000.r0.log',
|
54
|
+
'3p.limit.h1000.r0.actions.log',
|
55
|
+
['p1', 'p2', 'p3']
|
56
|
+
),
|
57
|
+
MatchLog.new(
|
58
|
+
'3p.nolimit.h1000.r0.log',
|
59
|
+
'3p.nolimit.h1000.r0.actions.log',
|
60
|
+
['p1', 'p2', 'p3']
|
61
|
+
)
|
62
|
+
]
|
63
|
+
end
|
64
|
+
|
65
|
+
def initialize(results_file_name, actions_file_name, player_names)
|
66
|
+
@results_file_name = results_file_name
|
67
|
+
@actions_file_name = actions_file_name
|
68
|
+
@player_names = player_names
|
69
|
+
end
|
70
|
+
|
71
|
+
def actions_file_path
|
72
|
+
"#{DEALER_LOG_DIRECTORY}/#{@actions_file_name}"
|
73
|
+
end
|
74
|
+
|
75
|
+
def results_file_path
|
76
|
+
"#{DEALER_LOG_DIRECTORY}/#{@results_file_name}"
|
77
|
+
end
|
33
78
|
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: 3.
|
4
|
+
version: 3.2.0
|
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-
|
11
|
+
date: 2013-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: process_runner
|