pokerstats 2.0.16 → 2.0.17
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.
- data/VERSION +1 -1
- data/bin/checkps +19 -37
- data/lib/pokerstats/player_statistics.rb +22 -0
- data/lib/pokerstats/plugins/street_bet_statistics.rb +6 -1
- data/lib/pokerstats/pokerstars_hand_history_parser.rb +12 -6
- data/pokerstats.gemspec +2 -2
- data/spec/hand_statistics_spec.rb +64 -0
- data/spec/player_statistics_spec.rb +31 -8
- data/spec/pokerstars_hand_history_parser_spec.rb +22 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.17
|
data/bin/checkps
CHANGED
@@ -76,19 +76,27 @@ def dopsfile(file, players_shown)
|
|
76
76
|
STDOUT.sync = false
|
77
77
|
puts "=" * file.size
|
78
78
|
reports = statistics.reports
|
79
|
-
printf "%-20s
|
80
|
-
|
79
|
+
printf "%-20s|%3s %4s %4s %5s %5s %5s|%5s %5s %5s|%5s %5s %5s | %s\n", "Screen Name", "Num", "VP$%", "PFR%", "Pre/Pos", "BAtt%", "BDef%",
|
80
|
+
"CBet%", "Call", "Fold", "3Bet%", "Call", "Fold", "Poker-Edge Description"
|
81
|
+
puts "--------------------|---------------------------------|-----------------|------------------|--------------------------------------------"
|
81
82
|
players.each do |each|
|
82
83
|
report = reports[each]
|
83
84
|
# puts report.to_yaml
|
84
85
|
t_hands = report[:t_hands]
|
85
86
|
vpi_p = display_ratio report[:t_vpip], report[:t_hands]
|
86
87
|
pfr_p = display_ratio report[:t_pfr_opportunity_taken], report[:t_pfr_opportunity]
|
87
|
-
prefa = report[:t_preflop_passive].
|
88
|
-
posfa = report[:t_postflop_passive].
|
88
|
+
prefa = report[:t_preflop_passive].zero? ? 0.0 : [1.0 * report[:t_preflop_aggressive] / report[:t_preflop_passive],9.9].min
|
89
|
+
posfa = report[:t_postflop_passive].zero? ? 0.0 : [1.0 * report[:t_postflop_aggressive] / report[:t_postflop_passive],9.9].min
|
89
90
|
batt_p = display_ratio report[:t_blind_attack_opportunity_taken], report[:t_blind_attack_opportunity]
|
90
91
|
bdef_p = display_ratio report[:t_blind_defense_opportunity_taken], report[:t_blind_defense_opportunity]
|
91
|
-
|
92
|
+
cbet_flop_p = display_ratio report[:t_cbet_flop_opportunity_taken], report[:t_cbet_flop_opportunity]
|
93
|
+
call_cbet_flop_p = display_ratio report[:t_call_cbet_flop_opportunity_taken], report[:t_call_cbet_flop_opportunity]
|
94
|
+
fold_to_cbet_flop_p = display_ratio report[:t_fold_to_cbet_flop_opportunity_taken], report[:t_fold_to_cbet_flop_opportunity]
|
95
|
+
preflop_3bet_p = display_ratio report[:t_preflop_3bet_opportunity_taken], report[:t_preflop_3bet_opportunity]
|
96
|
+
call_preflop_3bet_p = display_ratio report[:t_call_preflop_3bet_opportunity_taken], report[:t_call_preflop_3bet_opportunity]
|
97
|
+
fold_to_preflop_3bet_p = display_ratio report[:t_fold_to_preflop_3bet_opportunity_taken], report[:t_fold_to_preflop_3bet_opportunity]
|
98
|
+
|
99
|
+
|
92
100
|
description = players_shown[each][/\(.*\)/]
|
93
101
|
description ||= ""
|
94
102
|
description.gsub!("Passive", "P")
|
@@ -96,41 +104,15 @@ def dopsfile(file, players_shown)
|
|
96
104
|
description.gsub!("Tight", "T")
|
97
105
|
description.gsub!("Loose", "L")
|
98
106
|
players_shown[each].gsub!(/\(.*\)/, description)
|
99
|
-
printf "%-20s
|
107
|
+
printf "%-20s|%3d %4s %4s %2.1f/%2.1f %5s %5s|%5s %5s %5s|%5s %5s %5s | %s\n",
|
108
|
+
each, t_hands, vpi_p, pfr_p, prefa, posfa, batt_p, bdef_p,
|
109
|
+
cbet_flop_p, call_cbet_flop_p, fold_to_cbet_flop_p,
|
110
|
+
preflop_3bet_p, call_preflop_3bet_p,fold_to_preflop_3bet_p,
|
111
|
+
players_shown[each]
|
112
|
+
# puts report.to_yaml
|
100
113
|
end
|
101
114
|
puts "=" * file.size
|
102
115
|
GC.start
|
103
|
-
# puts last.reports.keys.inspect
|
104
|
-
# puts
|
105
|
-
# # puts
|
106
|
-
# # puts "=" * 90
|
107
|
-
# # puts last.path
|
108
|
-
# # players.each {|each| display(each, players_shown)}
|
109
|
-
# # puts
|
110
|
-
# # puts "=" * 90
|
111
|
-
# # puts "PLAYERS NOW AT THIS TABLE"
|
112
|
-
# # puts "=" * 90
|
113
|
-
# # printf "%-20s %3s %4s %4s %5s %s\n", "Screen Name", "Num", "VP$%", "PFR%", "Pre/Pos", "Poker-Edge Description"
|
114
|
-
# # printf "%-20s %-14s %s\n", "-"*20, "-"*21, "-"*47
|
115
|
-
# # players.each do |each|
|
116
|
-
# # description = players_shown[each][/\(.*\)/]
|
117
|
-
# # description ||= ""
|
118
|
-
# # description.gsub!("Passive", "P")
|
119
|
-
# # description.gsub!("Aggressive", "A")
|
120
|
-
# # description.gsub!("Tight", "T")
|
121
|
-
# # description.gsub!("Loose", "L")
|
122
|
-
# # players_shown[each].gsub!(/\(.*\)/, description)
|
123
|
-
# # printf "%-20s %3d %3d%% %3d%% %2.1f/%2.1f %s\n", each,
|
124
|
-
# # hands[each], (100.0 * vpip[each])/hands[each], (100.0 * pfr[each])/hands[each],
|
125
|
-
# # preflop_passive[each].zero? ? 0.0 : (1.0 * preflop_aggressive[each]) / preflop_passive[each],
|
126
|
-
# # postflop_passive[each].zero? ? 0.0 : (1.0 * postflop_aggressive[each]) / postflop_passive[each],
|
127
|
-
# # players_shown[each]
|
128
|
-
# # end
|
129
|
-
# # puts "=" * 90
|
130
|
-
# # puts "information on #{hands.size} players collected"
|
131
|
-
# # hands = vpip = pfr = sawflop = preflop_aggressive = preflop_passive = nil
|
132
|
-
|
133
|
-
# # puts
|
134
116
|
end
|
135
117
|
|
136
118
|
def newpsfiles(user, time)
|
@@ -18,6 +18,17 @@ module Pokerstats
|
|
18
18
|
@aggregate_statistics[each_player][aggregate_stat] ||= 0
|
19
19
|
@aggregate_statistics[each_player][aggregate_stat] += 1 if reports[each_player][hand_stat]
|
20
20
|
end
|
21
|
+
|
22
|
+
def aggregate_three_part_statistic each_player, reports, aggregate_stat, hand_stat
|
23
|
+
# puts "a3ps(#{each_player},reports,#{aggregate_stat.inspect},#{hand_stat.inspect}) where reports[][]=#{reports[each_player][hand_stat].inspect}" if each_player == "wizardwerdna"
|
24
|
+
raise "diddledoo#{hand_stat}" unless reports[each_player].keys.include?(hand_stat)
|
25
|
+
t_stat_opportunity = ((aggregate_stat.to_s) + "_opportunity").to_sym
|
26
|
+
t_stat_opportunity_taken = ((aggregate_stat.to_s) + "_opportunity_taken").to_sym
|
27
|
+
@aggregate_statistics[each_player][t_stat_opportunity] ||=0
|
28
|
+
@aggregate_statistics[each_player][t_stat_opportunity_taken] ||=0
|
29
|
+
@aggregate_statistics[each_player][t_stat_opportunity] += 1 unless reports[each_player][hand_stat].nil?
|
30
|
+
@aggregate_statistics[each_player][t_stat_opportunity_taken] += 1 if reports[each_player][hand_stat]
|
31
|
+
end
|
21
32
|
|
22
33
|
def aggregate_statistic each_player, reports, aggregate_stat, hand_stat
|
23
34
|
@aggregate_statistics[each_player][aggregate_stat] ||= 0
|
@@ -30,7 +41,10 @@ module Pokerstats
|
|
30
41
|
|
31
42
|
def record hand_statistics
|
32
43
|
reports = hand_statistics.reports
|
44
|
+
# puts reports.to_yaml
|
33
45
|
reports.keys.each do |each_player|
|
46
|
+
raise "cbet_flop for #{each_player} inconsistent" if reports[:call_cbet_flop].nil? ^ reports[:fold_to_cbet_flop].nil?
|
47
|
+
raise "preflop_3bet for #{each_player} inconsistent" if reports[:call_preflop_3bet].nil? ^ reports[:fold_to_preflop_3bet].nil?
|
34
48
|
@aggregate_statistics[each_player] ||= {}
|
35
49
|
|
36
50
|
@aggregate_statistics[each_player][:t_hands] ||= 0
|
@@ -52,6 +66,14 @@ module Pokerstats
|
|
52
66
|
aggregate_boolean_statistic each_player, reports, :t_pfr_opportunity_taken, :is_pfr_opportunity_taken
|
53
67
|
aggregate_boolean_statistic each_player, reports, :t_cbet_opportunity, :is_cbet_opportunity
|
54
68
|
aggregate_boolean_statistic each_player, reports, :t_cbet_opportunity_taken, :is_cbet_opportunity_taken
|
69
|
+
aggregate_three_part_statistic each_player, reports, :t_cbet_flop, :cbet_flop
|
70
|
+
aggregate_three_part_statistic each_player, reports, :t_fold_to_cbet_flop, :fold_to_cbet_flop
|
71
|
+
aggregate_three_part_statistic each_player, reports, :t_call_cbet_flop, :call_cbet_flop
|
72
|
+
aggregate_three_part_statistic each_player, reports, :t_preflop_3bet, :preflop_3bet
|
73
|
+
aggregate_three_part_statistic each_player, reports, :t_fold_to_preflop_3bet, :fold_to_preflop_3bet
|
74
|
+
aggregate_three_part_statistic each_player, reports, :t_call_preflop_3bet, :call_preflop_3bet
|
75
|
+
raise "messed up cbet_flop for #{each_player}" unless @aggregate_statistics[each_player][:t_call_cbet_flop_opportunity] == @aggregate_statistics[each_player][:t_fold_to_cbet_flop_opportunity]
|
76
|
+
raise "messed up preflop_3bet for #{each_player}" unless @aggregate_statistics[each_player][:t_call_preflop_3bet_opportunity] == @aggregate_statistics[each_player][:t_fold_to_preflop_3bet_opportunity]
|
55
77
|
end
|
56
78
|
end
|
57
79
|
end
|
@@ -60,6 +60,9 @@ module Pokerstats
|
|
60
60
|
[:cbet_flop, 'boolean', :cbet_flop],
|
61
61
|
[:cbet_turn, 'boolean', :cbet_turn],
|
62
62
|
[:cbet_river, 'boolean', :cbet_river],
|
63
|
+
[:call_cbet_flop, 'boolean', :call_cbet_flop],
|
64
|
+
[:call_cbet_turn, 'boolean', :call_cbet_turn],
|
65
|
+
[:call_cbet_river, 'boolean', :call_cbet_river],
|
63
66
|
[:fold_to_cbet_flop, 'boolean', :fold_to_cbet_flop],
|
64
67
|
[:fold_to_cbet_turn, 'boolean', :fold_to_cbet_turn],
|
65
68
|
[:fold_to_cbet_river, 'boolean', :fold_to_cbet_river],
|
@@ -67,6 +70,9 @@ module Pokerstats
|
|
67
70
|
[:dbet_flop, 'boolean', :dbet_flop],
|
68
71
|
[:dbet_turn, 'boolean', :dbet_turn],
|
69
72
|
[:dbet_river, 'boolean', :dbet_river],
|
73
|
+
[:call_dbet_flop, 'boolean', :call_dbet_flop],
|
74
|
+
[:call_dbet_turn, 'boolean', :call_dbet_turn],
|
75
|
+
[:call_dbet_river, 'boolean', :call_dbet_river],
|
70
76
|
[:fold_to_dbet_flop, 'boolean', :fold_to_dbet_flop],
|
71
77
|
[:fold_to_dbet_turn, 'boolean', :fold_to_dbet_turn],
|
72
78
|
[:fold_to_dbet_river, 'boolean', :fold_to_dbet_river]
|
@@ -147,7 +153,6 @@ module Pokerstats
|
|
147
153
|
end
|
148
154
|
def fold_to_cbet_#{street}(player)
|
149
155
|
@first_aggr_player[:#{street}] && cbet_#{street}(@first_aggr_player[:#{street}]) && fold_to_#{street}_1bet(player)
|
150
|
-
# fold_to_#{street}_1bet(player) && @last_aggr_player[:#{last_street}] && cbet_#{street}(@last_aggr_player[:#{last_street}])
|
151
156
|
end
|
152
157
|
def call_cbet_#{street}(player)
|
153
158
|
@first_aggr_player[:#{street}] && cbet_#{street}(@first_aggr_player[:#{street}]) && call_#{street}_1bet(player)
|
@@ -121,12 +121,18 @@ module Pokerstats
|
|
121
121
|
# :played_at=> PokerstarsTimeStringConverter.new($8).as_utc_datetime,
|
122
122
|
# :street => :prelude, :board => "", :max_players => 0, :number_players => 0, :table_name => "",
|
123
123
|
# :game_type => "Hold'em", :limit_type => "No Limit", :stakes_type => cash_to_d($3)
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
124
|
+
when /PokerStars Game #([0-9]+): Tournament #([0-9]+), (Freeroll|(#{CASH})\+(#{CASH}) *(USD)?) +Hold'em No Limit -.*Level ([IVXL]+) \((#{CASH})\/(#{CASH})\) - (.*)$/
|
125
|
+
@stats.update_hand :name => "PS#{$1}", :description=> "#{$2}, #{$3} Hold'em No Limit", :tournament=> $2,
|
126
|
+
:sb=> $8.to_d, :bb=> $9.to_d, :ante => "0.0".to_d,
|
127
|
+
:played_at=> PokerstarsTimeStringConverter.new($10).as_utc_datetime,
|
128
|
+
:street => :prelude, :board => "", :max_players => 0, :number_players => 0, :table_name => "",
|
129
|
+
:game_type => "Hold'em", :limit_type => "No Limit", :stakes_type => cash_to_d($4)
|
130
|
+
when /PokerStars Game #([0-9]+): Tournament #([0-9]+), (Freeroll|(#{CASH}).*(FPP)) *(USD)? +Hold'em No Limit -.*Level ([IVXL]+) \((#{CASH})\/(#{CASH})\) - (.*)$/
|
131
|
+
@stats.update_hand :name => "PS#{$1}", :description=> "#{$2}, #{$3} Hold'em No Limit", :tournament=> $2,
|
132
|
+
:sb=> $8.to_d, :bb=> $9.to_d, :ante => "0.0".to_d,
|
133
|
+
:played_at=> PokerstarsTimeStringConverter.new($10).as_utc_datetime,
|
134
|
+
:street => :prelude, :board => "", :max_players => 0, :number_players => 0, :table_name => "",
|
135
|
+
:game_type => "Hold'em", :limit_type => "No Limit", :stakes_type => "0".to_d
|
130
136
|
when /PokerStars Game #([0-9]+): +([^(]*)Hold'em No Limit \((#{CASH})\/(#{CASH})\) - (.*)$/
|
131
137
|
@stats.update_hand :name => "PS#{$1}", :description=> "#{$2}Hold'em No Limit (#{$3}/#{$4})", :tournament=> nil,
|
132
138
|
:sb=> cash_to_d($3), :bb=> cash_to_d($4), :ante => "0.0".to_d,
|
data/pokerstats.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{pokerstats}
|
8
|
-
s.version = "2.0.
|
8
|
+
s.version = "2.0.17"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Andrew C. Greenberg"]
|
12
|
-
s.date = %q{2009-11-
|
12
|
+
s.date = %q{2009-11-21}
|
13
13
|
s.default_executable = %q{checkps}
|
14
14
|
s.description = %q{a library for extracting, computing and reporting statistics of poker hands parsed from hand history files}
|
15
15
|
s.email = %q{wizardwerdna@gmail.com}
|
@@ -127,6 +127,52 @@ Spec::Matchers.define :have_street_bet_statistics_specified_by do |street_hash,
|
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
130
|
+
Spec::Matchers.define :have_consistent_street_bet_statistics do
|
131
|
+
match do |hand_statistics|
|
132
|
+
@errors = []
|
133
|
+
for street in [:flop, :turn, :river]
|
134
|
+
for player in hand_statistics.players
|
135
|
+
fs = "fold_to_cbet_#{street}".to_sym
|
136
|
+
cs = "call_cbet_#{street}".to_sym
|
137
|
+
if hand_statistics.send(fs, player).nil? ^ hand_statistics.send(cs, player).nil?
|
138
|
+
@errors << {:fold_symbol => fs, :call_symbol => cs, :player => player}
|
139
|
+
end
|
140
|
+
fs = "fold_to_dbet_#{street}".to_sym
|
141
|
+
cs = "call_dbet_#{street}".to_sym
|
142
|
+
if hand_statistics.send(fs, player).nil? ^ hand_statistics.send(cs, player).nil?
|
143
|
+
@errors << {:fold_symbol => fs, :call_symbol => cs, :player => player}
|
144
|
+
end
|
145
|
+
end
|
146
|
+
for bet in 1..4
|
147
|
+
for player in hand_statistics.players
|
148
|
+
fs = bet_statistics_proc_symbol(street, bet, "fold_to_")
|
149
|
+
cs = bet_statistics_proc_symbol(street, bet, "call_")
|
150
|
+
if hand_statistics.send(fs, player).nil? ^ hand_statistics.send(cs, player).nil?
|
151
|
+
@errors << {:fold_symbol => fs, :call_symbol => cs, :player => player}
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
@errors.empty?
|
157
|
+
end
|
158
|
+
|
159
|
+
failure_message_for_should do |hand_statistics|
|
160
|
+
@errors.collect do |each|
|
161
|
+
"inconsistent results: #{each[:fold_symbol]}(#{each[:player]}) = #{hand_statistics.send(each[:fold_symbol], each[:player]).inspect}," +
|
162
|
+
" but #{each[:call_symbol]}(#{each[:player]}) = #{hand_statistics.send(each[:call_symbol], each[:player]).inspect}"
|
163
|
+
end.join("; \n")
|
164
|
+
end
|
165
|
+
|
166
|
+
failure_message_for_should_not do |hand_statistics|
|
167
|
+
"the statistics were consistent"
|
168
|
+
end
|
169
|
+
|
170
|
+
description do
|
171
|
+
"have consistent call_* and fold_to_* statistics for each player"
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
|
130
176
|
Spec::Matchers.define :have_last_aggr do |street, screen_name|
|
131
177
|
match do |hand_statistics|
|
132
178
|
@errors = []
|
@@ -1257,6 +1303,7 @@ describe HandStatistics do
|
|
1257
1303
|
it {@stats.should have_street_bet_statistics_specified_by @bet_specification, ""}
|
1258
1304
|
it {@stats.should have_street_bet_statistics_specified_by @call_bet_specification, "call_"}
|
1259
1305
|
it {@stats.should have_street_bet_statistics_specified_by @fold_to_bet_specification, "fold_to_"}
|
1306
|
+
it {@stats.should have_consistent_street_bet_statistics}
|
1260
1307
|
end
|
1261
1308
|
|
1262
1309
|
context "after 1 raise" do
|
@@ -1287,6 +1334,7 @@ describe HandStatistics do
|
|
1287
1334
|
it {@stats.should have_street_bet_statistics_specified_by @bet_specification, ""}
|
1288
1335
|
it {@stats.should have_street_bet_statistics_specified_by @call_bet_specification, "call_"}
|
1289
1336
|
it {@stats.should have_street_bet_statistics_specified_by @fold_to_bet_specification, "fold_to_"}
|
1337
|
+
it {@stats.should have_consistent_street_bet_statistics}
|
1290
1338
|
end
|
1291
1339
|
context "other streets" do
|
1292
1340
|
before(:each) do
|
@@ -1316,6 +1364,7 @@ describe HandStatistics do
|
|
1316
1364
|
it {@stats.should have_street_bet_statistics_specified_by @bet_specification, ""}
|
1317
1365
|
it {@stats.should have_street_bet_statistics_specified_by @call_bet_specification, "call_"}
|
1318
1366
|
it {@stats.should have_street_bet_statistics_specified_by @fold_to_bet_specification, "fold_to_"}
|
1367
|
+
it {@stats.should have_consistent_street_bet_statistics}
|
1319
1368
|
end
|
1320
1369
|
end
|
1321
1370
|
|
@@ -1347,6 +1396,7 @@ describe HandStatistics do
|
|
1347
1396
|
it {@stats.should have_street_bet_statistics_specified_by @bet_specification, ""}
|
1348
1397
|
it {@stats.should have_street_bet_statistics_specified_by @call_bet_specification, "call_"}
|
1349
1398
|
it {@stats.should have_street_bet_statistics_specified_by @fold_to_bet_specification, "fold_to_"}
|
1399
|
+
it {@stats.should have_consistent_street_bet_statistics}
|
1350
1400
|
end
|
1351
1401
|
context "other streets" do
|
1352
1402
|
before(:each) do
|
@@ -1380,6 +1430,7 @@ describe HandStatistics do
|
|
1380
1430
|
it {@stats.should have_street_bet_statistics_specified_by @bet_specification, ""}
|
1381
1431
|
it {@stats.should have_street_bet_statistics_specified_by @call_bet_specification, "call_"}
|
1382
1432
|
it {@stats.should have_street_bet_statistics_specified_by @fold_to_bet_specification, "fold_to_"}
|
1433
|
+
it {@stats.should have_consistent_street_bet_statistics}
|
1383
1434
|
end
|
1384
1435
|
end
|
1385
1436
|
|
@@ -1412,6 +1463,7 @@ describe HandStatistics do
|
|
1412
1463
|
it {@stats.should have_street_bet_statistics_specified_by @bet_specification, ""}
|
1413
1464
|
it {@stats.should have_street_bet_statistics_specified_by @call_bet_specification, "call_"}
|
1414
1465
|
it {@stats.should have_street_bet_statistics_specified_by @fold_to_bet_specification, "fold_to_"}
|
1466
|
+
it {@stats.should have_consistent_street_bet_statistics}
|
1415
1467
|
end
|
1416
1468
|
context "other streets" do
|
1417
1469
|
before(:each) do
|
@@ -1446,6 +1498,7 @@ describe HandStatistics do
|
|
1446
1498
|
it {@stats.should have_street_bet_statistics_specified_by @bet_specification, ""}
|
1447
1499
|
it {@stats.should have_street_bet_statistics_specified_by @call_bet_specification, "call_"}
|
1448
1500
|
it {@stats.should have_street_bet_statistics_specified_by @fold_to_bet_specification, "fold_to_"}
|
1501
|
+
it {@stats.should have_consistent_street_bet_statistics}
|
1449
1502
|
end
|
1450
1503
|
end
|
1451
1504
|
|
@@ -1475,6 +1528,7 @@ describe HandStatistics do
|
|
1475
1528
|
it {@stats.should have_street_bet_statistics_specified_by @bet_specification, ""}
|
1476
1529
|
it {@stats.should have_street_bet_statistics_specified_by @call_bet_specification, "call_"}
|
1477
1530
|
it {@stats.should have_street_bet_statistics_specified_by @fold_to_bet_specification, "fold_to_"}
|
1531
|
+
it {@stats.should have_consistent_street_bet_statistics}
|
1478
1532
|
end
|
1479
1533
|
context "other streets" do
|
1480
1534
|
before(:each) do
|
@@ -1506,6 +1560,7 @@ describe HandStatistics do
|
|
1506
1560
|
it {@stats.should have_street_bet_statistics_specified_by @bet_specification, ""}
|
1507
1561
|
it {@stats.should have_street_bet_statistics_specified_by @call_bet_specification, "call_"}
|
1508
1562
|
it {@stats.should have_street_bet_statistics_specified_by @fold_to_bet_specification, "fold_to_"}
|
1563
|
+
it {@stats.should have_consistent_street_bet_statistics}
|
1509
1564
|
end
|
1510
1565
|
end
|
1511
1566
|
end
|
@@ -1539,6 +1594,7 @@ describe HandStatistics do
|
|
1539
1594
|
@stats.call_dbet_flop(player).should be_nil
|
1540
1595
|
@stats.fold_to_dbet_flop(player).should be_nil
|
1541
1596
|
end
|
1597
|
+
@stats.should have_consistent_street_bet_statistics
|
1542
1598
|
end
|
1543
1599
|
|
1544
1600
|
context "when button last bets each street and bets first in on the next" do
|
@@ -1575,6 +1631,7 @@ describe HandStatistics do
|
|
1575
1631
|
@stats.send("call_dbet_#{street}", "sb").should be_nil
|
1576
1632
|
@stats.send("fold_to_dbet_#{street}", "bb").should be_nil
|
1577
1633
|
end
|
1634
|
+
@stats.should have_consistent_street_bet_statistics
|
1578
1635
|
end
|
1579
1636
|
end
|
1580
1637
|
end
|
@@ -1611,6 +1668,7 @@ describe HandStatistics do
|
|
1611
1668
|
@stats.send("fold_to_dbet_#{street}", "sb").should be_nil
|
1612
1669
|
@stats.send("fold_to_dbet_#{street}", "bb").should be_nil
|
1613
1670
|
@stats.send("fold_to_dbet_#{street}", "button").should be_false
|
1671
|
+
@stats.should have_consistent_street_bet_statistics
|
1614
1672
|
end
|
1615
1673
|
end
|
1616
1674
|
end
|
@@ -1650,6 +1708,7 @@ describe HandStatistics do
|
|
1650
1708
|
@stats.send("call_dbet_#{street}", "sb").should be_nil
|
1651
1709
|
@stats.send("fold_to_dbet_#{street}", "bb").should be_nil
|
1652
1710
|
end
|
1711
|
+
@stats.should have_consistent_street_bet_statistics
|
1653
1712
|
end
|
1654
1713
|
end
|
1655
1714
|
end
|
@@ -1679,6 +1738,7 @@ describe HandStatistics do
|
|
1679
1738
|
[:sb, :bb, :button].each do |player|
|
1680
1739
|
@stats.dbet_flop(player).should be_nil
|
1681
1740
|
end
|
1741
|
+
@stats.should have_consistent_street_bet_statistics
|
1682
1742
|
end
|
1683
1743
|
end
|
1684
1744
|
|
@@ -1710,6 +1770,7 @@ describe HandStatistics do
|
|
1710
1770
|
[:sb, :bb, :button].each do |player|
|
1711
1771
|
@stats.dbet_turn(player).should be_nil
|
1712
1772
|
end
|
1773
|
+
@stats.should have_consistent_street_bet_statistics
|
1713
1774
|
end
|
1714
1775
|
end
|
1715
1776
|
|
@@ -1741,6 +1802,7 @@ describe HandStatistics do
|
|
1741
1802
|
[:sb, :bb, :button].each do |player|
|
1742
1803
|
@stats.dbet_river(player).should be_nil
|
1743
1804
|
end
|
1805
|
+
@stats.should have_consistent_street_bet_statistics
|
1744
1806
|
end
|
1745
1807
|
end
|
1746
1808
|
end
|
@@ -1843,8 +1905,10 @@ describe HandStatistics do
|
|
1843
1905
|
:fold_to_river_1bet, :fold_to_river_2bet, :fold_to_river_3bet, :fold_to_river_4bet,
|
1844
1906
|
:last_aggr_preflop, :last_aggr_flop, :last_aggr_turn, :last_aggr_river,
|
1845
1907
|
:cbet_flop, :cbet_turn, :cbet_river,
|
1908
|
+
:call_cbet_flop, :call_cbet_turn, :call_cbet_river,
|
1846
1909
|
:fold_to_cbet_flop, :fold_to_cbet_turn, :fold_to_cbet_river,
|
1847
1910
|
:dbet_flop, :dbet_turn, :dbet_river,
|
1911
|
+
:call_dbet_flop, :call_dbet_turn, :call_dbet_river,
|
1848
1912
|
:fold_to_dbet_flop, :fold_to_dbet_turn, :fold_to_dbet_river
|
1849
1913
|
]
|
1850
1914
|
report_items.each{|report_item| @street_bet_plugin.should_receive(report_item).exactly(@stats.players.size)}
|
@@ -22,7 +22,9 @@ TEST = [
|
|
22
22
|
:postflop_passive => 3,
|
23
23
|
:postflop_aggressive => 4,
|
24
24
|
:is_pfr_opportunity => true,
|
25
|
-
:is_pfr_opportunity_taken => true
|
25
|
+
:is_pfr_opportunity_taken => true,
|
26
|
+
:flop_cbet => true,
|
27
|
+
:flop_2bet => true
|
26
28
|
},
|
27
29
|
"judi" => {
|
28
30
|
:is_blind_attack_opportunity => true,
|
@@ -40,7 +42,9 @@ TEST = [
|
|
40
42
|
:postflop_passive => 30,
|
41
43
|
:postflop_aggressive => 40,
|
42
44
|
:is_pfr_opportunity => true,
|
43
|
-
:is_pfr_opportunity_taken => false
|
45
|
+
:is_pfr_opportunity_taken => false,
|
46
|
+
:flop_cbet => false,
|
47
|
+
:flop_2bet => false
|
44
48
|
}
|
45
49
|
},
|
46
50
|
{"andy" => {
|
@@ -59,7 +63,9 @@ TEST = [
|
|
59
63
|
:postflop_passive => 6,
|
60
64
|
:postflop_aggressive => 8,
|
61
65
|
:is_pfr_opportunity => true,
|
62
|
-
:is_pfr_opportunity_taken => true
|
66
|
+
:is_pfr_opportunity_taken => true,
|
67
|
+
:flop_cbet => false,
|
68
|
+
:flop_2bet => true
|
63
69
|
},
|
64
70
|
"judi" => {
|
65
71
|
:is_blind_attack_opportunity => true,
|
@@ -77,7 +83,9 @@ TEST = [
|
|
77
83
|
:postflop_passive => 60,
|
78
84
|
:postflop_aggressive => 80,
|
79
85
|
:is_pfr_opportunity => true,
|
80
|
-
:is_pfr_opportunity_taken => false
|
86
|
+
:is_pfr_opportunity_taken => false,
|
87
|
+
:flop_cbet => nil,
|
88
|
+
:flop_2bet => false
|
81
89
|
}
|
82
90
|
},
|
83
91
|
{"andy" => {
|
@@ -96,7 +104,9 @@ TEST = [
|
|
96
104
|
:postflop_passive => 9,
|
97
105
|
:postflop_aggressive => 12,
|
98
106
|
:is_pfr_opportunity => true,
|
99
|
-
:is_pfr_opportunity_taken => true
|
107
|
+
:is_pfr_opportunity_taken => true,
|
108
|
+
:flop_cbet => nil,
|
109
|
+
:flop_2bet => true
|
100
110
|
},
|
101
111
|
"judi" => {
|
102
112
|
:is_blind_attack_opportunity => true,
|
@@ -114,7 +124,9 @@ TEST = [
|
|
114
124
|
:postflop_passive => 90,
|
115
125
|
:postflop_aggressive => 120,
|
116
126
|
:is_pfr_opportunity => true,
|
117
|
-
:is_pfr_opportunity_taken => false
|
127
|
+
:is_pfr_opportunity_taken => false,
|
128
|
+
:flop_cbet => nil,
|
129
|
+
:flop_2bet => false
|
118
130
|
}
|
119
131
|
}
|
120
132
|
]
|
@@ -137,7 +149,11 @@ PS_RESULT = {
|
|
137
149
|
:t_postflop_passive => 18,
|
138
150
|
:t_postflop_aggressive => 24,
|
139
151
|
:t_pfr_opportunity => 3,
|
140
|
-
:t_pfr_opportunity_taken => 3
|
152
|
+
:t_pfr_opportunity_taken => 3,
|
153
|
+
:t_flop_2bet_opportunity => 3,
|
154
|
+
:t_flop_2bet_opportunity_taken => 3,
|
155
|
+
:t_flop_cbet_opportunity => 2,
|
156
|
+
:t_flop_cbet_opportunity_taken => 1
|
141
157
|
},
|
142
158
|
"judi" => {
|
143
159
|
:t_hands => 3,
|
@@ -156,7 +172,11 @@ PS_RESULT = {
|
|
156
172
|
:t_postflop_passive => 180,
|
157
173
|
:t_postflop_aggressive => 240,
|
158
174
|
:t_pfr_opportunity => 3,
|
159
|
-
:t_pfr_opportunity_taken => 0
|
175
|
+
:t_pfr_opportunity_taken => 0,
|
176
|
+
:t_flop_2bet_opportunity => 3,
|
177
|
+
:t_flop_2bet_opportunity_taken => 0,
|
178
|
+
:t_cbet_opportunity => 1,
|
179
|
+
:t_cbet_opportunity_taken => 0
|
160
180
|
}
|
161
181
|
}
|
162
182
|
|
@@ -227,4 +247,7 @@ describe PlayerStatistics, "when aggregating statistics" do
|
|
227
247
|
it 'should correctly aggregate preflop raise statistics' do
|
228
248
|
should_correctly_aggregate @reports, [:t_pfr_opportunity, :t_pfr_opportunity_taken]
|
229
249
|
end
|
250
|
+
it 'should correctly aggregate ternary statistics' do
|
251
|
+
should_correctly_aggregate @reports, [:t_flop_2bet, :t_flop_cbet]
|
252
|
+
end
|
230
253
|
end
|
@@ -137,6 +137,27 @@ describe PokerstarsHandHistoryParser, "when parsing structural matter" do
|
|
137
137
|
)
|
138
138
|
@parser.parse("PokerStars Game #24703545200: Tournament #137653257, Freeroll Hold'em No Limit - Level I (10/20) - 2009/02/07 19:24:12 ET")
|
139
139
|
end
|
140
|
+
|
141
|
+
it "should recognize a freeroll tournament hand history" do
|
142
|
+
@stats.should_receive(:update_hand).with(
|
143
|
+
:name => "PS27572086902",
|
144
|
+
:description => "158153393, 5125FPP Hold'em No Limit",
|
145
|
+
:ante => "0.0".to_d,
|
146
|
+
:table_name => "",
|
147
|
+
:max_players => 0,
|
148
|
+
:number_players => 0,
|
149
|
+
:sb => "10".to_d,
|
150
|
+
:bb => "20".to_d,
|
151
|
+
:played_at => DateTime.parse("2009/04/27 22:19:46 EDT"),
|
152
|
+
:tournament => "158153393",
|
153
|
+
:street => :prelude,
|
154
|
+
:board => "",
|
155
|
+
:game_type => "Hold'em",
|
156
|
+
:stakes_type => "0".to_d,
|
157
|
+
:limit_type => "No Limit"
|
158
|
+
)
|
159
|
+
@parser.parse("PokerStars Game #27572086902: Tournament #158153393, 5125FPP Hold'em No Limit - Level I (10/20) - 2009/04/27 22:19:46 ET")
|
160
|
+
end
|
140
161
|
|
141
162
|
it "should recognize a tournament header" do
|
142
163
|
PokerstarsHandHistoryParser.should have_valid_header("PokerStars Game #21650436825: Tournament #117620218, $10+$1 Hold'em No Limit - Level I (10/20) - 2008/10/31 17:25:42 ET\nsnuggles\n")
|
@@ -157,7 +178,7 @@ describe PokerstarsHandHistoryParser, "when parsing structural matter" do
|
|
157
178
|
:street => :prelude,
|
158
179
|
:board => "", # due to pokerstars hand history bug
|
159
180
|
:game_type => "Hold'em",
|
160
|
-
:stakes_type => "0.
|
181
|
+
:stakes_type => "0.5".to_d,
|
161
182
|
:limit_type => "No Limit"
|
162
183
|
)
|
163
184
|
@parser.parse("PokerStars Game #21650146783: Hold'em No Limit ($0.25/$0.50) - 2008/10/31 17:14:44 ET")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pokerstats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew C. Greenberg
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-21 00:00:00 -08:00
|
13
13
|
default_executable: checkps
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|