acpc_poker_types 0.0.7 → 0.0.8
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 +7 -0
- data/lib/acpc_poker_types/game_definition.rb +11 -7
- data/lib/acpc_poker_types/version.rb +1 -1
- data/spec/coverage/index.html +1 -1
- data/spec/player_spec.rb +22 -10
- data/spec/support/spec_helper.rb +1 -1
- metadata +22 -43
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 670a0709c65543ab0c9a74e7c09f64e41965c2a1
|
|
4
|
+
data.tar.gz: 79709b041df0760a1135ba094c2973f26d0ccdcd
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 47295c31969818050d26a16318da8ecee8d01456222bc4ff124450d4f8fe7682fcb456a97ff4f1511f69bac72f5612b25b5bc4ed1f0b2a6f8692b9ca332ec179
|
|
7
|
+
data.tar.gz: 80a36decd991e6bdd59114e6264d4af2bbb2c23367dde01566798205d8a0ae133924d1f6cff5e5c03044a01f22895f153971a2b57ee4a5e42aad031986d49d98
|
|
@@ -86,7 +86,7 @@ class GameDefinition
|
|
|
86
86
|
:@chip_stacks => 'stack',
|
|
87
87
|
:@number_of_players => 'numPlayers',
|
|
88
88
|
:@blinds => 'blind',
|
|
89
|
-
:@
|
|
89
|
+
:@raise_sizes => 'raiseSize',
|
|
90
90
|
:@number_of_rounds => 'numRounds',
|
|
91
91
|
:@first_player_positions => 'firstPlayer',
|
|
92
92
|
:@max_number_of_wagers => 'maxRaises',
|
|
@@ -177,7 +177,6 @@ class GameDefinition
|
|
|
177
177
|
end
|
|
178
178
|
|
|
179
179
|
@chip_stacks = GameDefinition.default_chip_stacks(@number_of_players) if @chip_stacks.empty?
|
|
180
|
-
@min_wagers = default_min_wagers(@number_of_rounds) if @min_wagers.empty?
|
|
181
180
|
|
|
182
181
|
unless @first_player_positions.any? { |pos| pos <= 0 }
|
|
183
182
|
@first_player_positions.map! { |position| position - 1 }
|
|
@@ -198,7 +197,7 @@ class GameDefinition
|
|
|
198
197
|
list_of_lines << "stack = #{@chip_stacks.join(' ')}" unless @chip_stacks.empty?
|
|
199
198
|
list_of_lines << "numPlayers = #{@number_of_players}" if @number_of_players
|
|
200
199
|
list_of_lines << "blind = #{@blinds.join(' ')}" unless @blinds.empty?
|
|
201
|
-
list_of_lines << "raiseSize = #{
|
|
200
|
+
list_of_lines << "raiseSize = #{min_wagers.join(' ')}" unless min_wagers.empty?
|
|
202
201
|
list_of_lines << "numRounds = #{@number_of_rounds}" if @number_of_rounds
|
|
203
202
|
list_of_lines << "firstPlayer = #{(@first_player_positions.map{|p| p + 1}).join(' ')}" unless @first_player_positions.empty?
|
|
204
203
|
list_of_lines << "maxRaises = #{@max_number_of_wagers.join(' ')}" unless @max_number_of_wagers.empty?
|
|
@@ -213,6 +212,14 @@ class GameDefinition
|
|
|
213
212
|
Set.new(to_a) == Set.new(other_game_definition.to_a)
|
|
214
213
|
end
|
|
215
214
|
|
|
215
|
+
def min_wagers
|
|
216
|
+
if @raise_sizes
|
|
217
|
+
@raise_sizes
|
|
218
|
+
else
|
|
219
|
+
@number_of_rounds.times.map { |i| @blinds.max }
|
|
220
|
+
end
|
|
221
|
+
end
|
|
222
|
+
|
|
216
223
|
private
|
|
217
224
|
|
|
218
225
|
def initialize_members!
|
|
@@ -221,7 +228,6 @@ class GameDefinition
|
|
|
221
228
|
@blinds = @number_of_players.times.inject([]) { |blinds, i| blinds << 0 }
|
|
222
229
|
@number_of_rounds = MIN_VALUES[:@number_of_rounds]
|
|
223
230
|
@number_of_board_cards = @number_of_rounds.times.inject([]) { |cards, i| cards << 0 }
|
|
224
|
-
@min_wagers = @number_of_rounds.times.inject([]) { |wagers, i| wagers << @blinds.max }
|
|
225
231
|
@first_player_positions = GameDefinition.default_first_player_positions @number_of_rounds
|
|
226
232
|
@max_number_of_wagers = GameDefinition.default_max_number_of_wagers @number_of_rounds
|
|
227
233
|
@chip_stacks = GameDefinition.default_chip_stacks @number_of_players
|
|
@@ -273,7 +279,7 @@ class GameDefinition
|
|
|
273
279
|
|
|
274
280
|
raise GameDefinitionParseError, "list of player stacks not specified" unless @chip_stacks
|
|
275
281
|
raise GameDefinitionParseError, "list of blinds not specified" unless @blinds
|
|
276
|
-
raise GameDefinitionParseError, "raise size in each round not specified" unless
|
|
282
|
+
raise GameDefinitionParseError, "raise size in each round not specified" unless min_wagers
|
|
277
283
|
raise GameDefinitionParseError, "first player position in each round not specified" unless @first_player_positions
|
|
278
284
|
raise GameDefinitionParseError, "maximum raise in each round not specified" unless @max_number_of_wagers
|
|
279
285
|
raise GameDefinitionParseError, "number of board cards in each round not specified" unless @number_of_board_cards
|
|
@@ -332,8 +338,6 @@ class GameDefinition
|
|
|
332
338
|
@number_of_rounds.times do |i|
|
|
333
339
|
@first_player_positions << 0 unless @first_player_positions.length > i
|
|
334
340
|
@number_of_board_cards << 0 unless @number_of_board_cards.length > i
|
|
335
|
-
|
|
336
|
-
@min_wagers << @blinds.max unless @min_wagers.length > i
|
|
337
341
|
end
|
|
338
342
|
end
|
|
339
343
|
end
|
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-
|
|
17
|
+
<div class="timestamp">Generated <abbr class="timeago" title="2013-05-01T13:11:23-06:00">2013-05-01T13:11:23-06:00</abbr></div>
|
|
18
18
|
<ul class="group_tabs"></ul>
|
|
19
19
|
|
|
20
20
|
<div id="content">
|
data/spec/player_spec.rb
CHANGED
|
@@ -158,15 +158,27 @@ describe Player do
|
|
|
158
158
|
check_patient
|
|
159
159
|
end
|
|
160
160
|
end
|
|
161
|
-
|
|
162
|
-
|
|
161
|
+
describe 'properly changes its state when it wins chips' do
|
|
162
|
+
it 'when the number of chips is an integer' do
|
|
163
|
+
@patient.chip_balance.should be == 0
|
|
163
164
|
|
|
164
|
-
|
|
165
|
-
|
|
165
|
+
pot_size = 22
|
|
166
|
+
@patient.take_winnings! pot_size
|
|
166
167
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
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]
|
|
171
|
+
end
|
|
172
|
+
it 'when the number of chips is a rational' do
|
|
173
|
+
@patient.chip_balance.should be == 0
|
|
174
|
+
|
|
175
|
+
pot_size = 22/3.to_r
|
|
176
|
+
@patient.take_winnings! pot_size
|
|
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]
|
|
181
|
+
end
|
|
170
182
|
end
|
|
171
183
|
it 'works properly over samples of data from the ACPC Dealer' do
|
|
172
184
|
dealer_log_directory = File.expand_path('../support/dealer_logs', __FILE__)
|
|
@@ -180,7 +192,7 @@ describe Player do
|
|
|
180
192
|
)
|
|
181
193
|
match.for_every_seat! do |seat|
|
|
182
194
|
@patient = Player.join_match(
|
|
183
|
-
match.match_def.player_names[seat],
|
|
195
|
+
match.match_def.player_names[seat],
|
|
184
196
|
seat,
|
|
185
197
|
match.match_def.game_def.chip_stacks[seat]
|
|
186
198
|
)
|
|
@@ -194,7 +206,7 @@ describe Player do
|
|
|
194
206
|
)
|
|
195
207
|
match.for_every_turn! do
|
|
196
208
|
if (
|
|
197
|
-
match.current_hand.last_action &&
|
|
209
|
+
match.current_hand.last_action &&
|
|
198
210
|
@patient.seat == match.current_hand.last_action.seat
|
|
199
211
|
)
|
|
200
212
|
@patient.take_action!(match.current_hand.last_action.action)
|
|
@@ -260,7 +272,7 @@ class Array
|
|
|
260
272
|
end
|
|
261
273
|
|
|
262
274
|
MatchLog = Struct.new(
|
|
263
|
-
:results_file_name,
|
|
275
|
+
:results_file_name,
|
|
264
276
|
:actions_file_name,
|
|
265
277
|
:player_names
|
|
266
278
|
)
|
data/spec/support/spec_helper.rb
CHANGED
metadata
CHANGED
|
@@ -1,126 +1,111 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: acpc_poker_types
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
5
|
-
prerelease:
|
|
4
|
+
version: 0.0.8
|
|
6
5
|
platform: ruby
|
|
7
6
|
authors:
|
|
8
7
|
- Dustin Morrill
|
|
9
8
|
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date: 2013-
|
|
11
|
+
date: 2013-05-03 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: dmorrill10-utils
|
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
|
17
|
-
none: false
|
|
18
16
|
requirements:
|
|
19
|
-
- -
|
|
17
|
+
- - '>='
|
|
20
18
|
- !ruby/object:Gem::Version
|
|
21
19
|
version: '0'
|
|
22
20
|
type: :runtime
|
|
23
21
|
prerelease: false
|
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
-
none: false
|
|
26
23
|
requirements:
|
|
27
|
-
- -
|
|
24
|
+
- - '>='
|
|
28
25
|
- !ruby/object:Gem::Version
|
|
29
26
|
version: '0'
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
|
31
28
|
name: acpc_dealer
|
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
|
33
|
-
none: false
|
|
34
30
|
requirements:
|
|
35
|
-
- -
|
|
31
|
+
- - '>='
|
|
36
32
|
- !ruby/object:Gem::Version
|
|
37
33
|
version: '0'
|
|
38
34
|
type: :runtime
|
|
39
35
|
prerelease: false
|
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
-
none: false
|
|
42
37
|
requirements:
|
|
43
|
-
- -
|
|
38
|
+
- - '>='
|
|
44
39
|
- !ruby/object:Gem::Version
|
|
45
40
|
version: '0'
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
|
47
42
|
name: acpc_dealer_data
|
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
|
49
|
-
none: false
|
|
50
44
|
requirements:
|
|
51
|
-
- -
|
|
45
|
+
- - '>='
|
|
52
46
|
- !ruby/object:Gem::Version
|
|
53
47
|
version: '0'
|
|
54
48
|
type: :development
|
|
55
49
|
prerelease: false
|
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
-
none: false
|
|
58
51
|
requirements:
|
|
59
|
-
- -
|
|
52
|
+
- - '>='
|
|
60
53
|
- !ruby/object:Gem::Version
|
|
61
54
|
version: '0'
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
|
63
56
|
name: celluloid
|
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
|
65
|
-
none: false
|
|
66
58
|
requirements:
|
|
67
|
-
- -
|
|
59
|
+
- - '>='
|
|
68
60
|
- !ruby/object:Gem::Version
|
|
69
61
|
version: '0'
|
|
70
62
|
type: :development
|
|
71
63
|
prerelease: false
|
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
73
|
-
none: false
|
|
74
65
|
requirements:
|
|
75
|
-
- -
|
|
66
|
+
- - '>='
|
|
76
67
|
- !ruby/object:Gem::Version
|
|
77
68
|
version: '0'
|
|
78
69
|
- !ruby/object:Gem::Dependency
|
|
79
70
|
name: rspec
|
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
|
81
|
-
none: false
|
|
82
72
|
requirements:
|
|
83
|
-
- -
|
|
73
|
+
- - '>='
|
|
84
74
|
- !ruby/object:Gem::Version
|
|
85
75
|
version: '0'
|
|
86
76
|
type: :development
|
|
87
77
|
prerelease: false
|
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
89
|
-
none: false
|
|
90
79
|
requirements:
|
|
91
|
-
- -
|
|
80
|
+
- - '>='
|
|
92
81
|
- !ruby/object:Gem::Version
|
|
93
82
|
version: '0'
|
|
94
83
|
- !ruby/object:Gem::Dependency
|
|
95
84
|
name: mocha
|
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
|
97
|
-
none: false
|
|
98
86
|
requirements:
|
|
99
|
-
- -
|
|
87
|
+
- - '>='
|
|
100
88
|
- !ruby/object:Gem::Version
|
|
101
89
|
version: '0'
|
|
102
90
|
type: :development
|
|
103
91
|
prerelease: false
|
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
105
|
-
none: false
|
|
106
93
|
requirements:
|
|
107
|
-
- -
|
|
94
|
+
- - '>='
|
|
108
95
|
- !ruby/object:Gem::Version
|
|
109
96
|
version: '0'
|
|
110
97
|
- !ruby/object:Gem::Dependency
|
|
111
98
|
name: simplecov
|
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
|
113
|
-
none: false
|
|
114
100
|
requirements:
|
|
115
|
-
- -
|
|
101
|
+
- - '>='
|
|
116
102
|
- !ruby/object:Gem::Version
|
|
117
103
|
version: '0'
|
|
118
104
|
type: :development
|
|
119
105
|
prerelease: false
|
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
-
none: false
|
|
122
107
|
requirements:
|
|
123
|
-
- -
|
|
108
|
+
- - '>='
|
|
124
109
|
- !ruby/object:Gem::Version
|
|
125
110
|
version: '0'
|
|
126
111
|
description: Poker classes and constants that conform to the standards of the Annual
|
|
@@ -259,33 +244,26 @@ files:
|
|
|
259
244
|
- spec/game_definition_spec.rb
|
|
260
245
|
homepage: https://github.com/dmorrill10/acpc_poker_types
|
|
261
246
|
licenses: []
|
|
247
|
+
metadata: {}
|
|
262
248
|
post_install_message:
|
|
263
249
|
rdoc_options: []
|
|
264
250
|
require_paths:
|
|
265
251
|
- lib
|
|
266
252
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
267
|
-
none: false
|
|
268
253
|
requirements:
|
|
269
|
-
- -
|
|
254
|
+
- - '>='
|
|
270
255
|
- !ruby/object:Gem::Version
|
|
271
256
|
version: '0'
|
|
272
|
-
segments:
|
|
273
|
-
- 0
|
|
274
|
-
hash: 4392869187144069601
|
|
275
257
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
276
|
-
none: false
|
|
277
258
|
requirements:
|
|
278
|
-
- -
|
|
259
|
+
- - '>='
|
|
279
260
|
- !ruby/object:Gem::Version
|
|
280
261
|
version: '0'
|
|
281
|
-
segments:
|
|
282
|
-
- 0
|
|
283
|
-
hash: 4392869187144069601
|
|
284
262
|
requirements: []
|
|
285
263
|
rubyforge_project:
|
|
286
|
-
rubygems_version:
|
|
264
|
+
rubygems_version: 2.0.0.rc.2
|
|
287
265
|
signing_key:
|
|
288
|
-
specification_version:
|
|
266
|
+
specification_version: 4
|
|
289
267
|
summary: ACPC Poker Types
|
|
290
268
|
test_files:
|
|
291
269
|
- spec/poker_action_spec.rb
|
|
@@ -398,3 +376,4 @@ test_files:
|
|
|
398
376
|
- spec/player_spec.rb
|
|
399
377
|
- spec/suit_spec.rb
|
|
400
378
|
- spec/game_definition_spec.rb
|
|
379
|
+
has_rdoc:
|