pokerstats 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bin/checkps +6 -6
- data/lib/pokerstats/hand_statistics.rb +1 -1
- data/lib/pokerstats/player_statistics.rb +11 -10
- data/lib/pokerstats/plugins/street_bet_statistics.rb +208 -117
- data/pokerstats.gemspec +2 -2
- data/spec/hand_history_spec.rb +2 -1
- data/spec/hand_statistics_spec.rb +117 -100
- data/spec/player_statistics_spec.rb +112 -143
- data/spec/pokerstars_file_spec.rb +1 -1
- data/spec/pokerstars_hand_history_parser_spec.rb +2 -1
- metadata +36 -21
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.
|
8
|
+
s.version = "2.2.0"
|
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{
|
12
|
+
s.date = %q{2010-02-23}
|
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}
|
data/spec/hand_history_spec.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
require '
|
2
|
+
require 'active_support'
|
3
3
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
4
4
|
require File.expand_path(File.dirname(__FILE__) + '/../lib/pokerstats/hand_statistics')
|
5
5
|
require File.expand_path(File.dirname(__FILE__) + '/../lib/pokerstats/hand_classification')
|
@@ -89,7 +89,19 @@ Spec::Matchers.define :have_saw_street_statistics_specified_by do |hash_of_hashe
|
|
89
89
|
end
|
90
90
|
|
91
91
|
def bet_statistics_proc_symbol(street, bet, prefix = "")
|
92
|
-
|
92
|
+
street_first = case street
|
93
|
+
when :preflop then :p
|
94
|
+
when :flop then :f
|
95
|
+
when :turn then :t
|
96
|
+
when :river then :r
|
97
|
+
end
|
98
|
+
prefix_adjust = case prefix
|
99
|
+
when "fold_to_" then "f2_"
|
100
|
+
when "call_" then "c_"
|
101
|
+
when "" then ""
|
102
|
+
else raise "wtf? #{prefix}"
|
103
|
+
end
|
104
|
+
"#{prefix_adjust}#{street_first}_#{bet}bet".to_s
|
93
105
|
end
|
94
106
|
|
95
107
|
Spec::Matchers.define :have_street_bet_statistics_specified_by do |street_hash, prefix|
|
@@ -131,14 +143,20 @@ Spec::Matchers.define :have_consistent_street_bet_statistics do
|
|
131
143
|
match do |hand_statistics|
|
132
144
|
@errors = []
|
133
145
|
for street in [:flop, :turn, :river]
|
146
|
+
street_first = case street
|
147
|
+
when :preflop then :p
|
148
|
+
when :flop then :f
|
149
|
+
when :turn then :t
|
150
|
+
when :river then :r
|
151
|
+
end
|
134
152
|
for player in hand_statistics.players
|
135
|
-
fs = "
|
136
|
-
cs = "
|
153
|
+
fs = "f2_#{street_first}_cbet".to_sym
|
154
|
+
cs = "c_#{street_first}_cbet".to_sym
|
137
155
|
if hand_statistics.send(fs, player).nil? ^ hand_statistics.send(cs, player).nil?
|
138
156
|
@errors << {:fold_symbol => fs, :call_symbol => cs, :player => player}
|
139
157
|
end
|
140
|
-
fs = "
|
141
|
-
cs = "
|
158
|
+
fs = "f2_#{street_first}_dbet".to_sym
|
159
|
+
cs = "c_#{street_first}_dbet".to_sym
|
142
160
|
if hand_statistics.send(fs, player).nil? ^ hand_statistics.send(cs, player).nil?
|
143
161
|
@errors << {:fold_symbol => fs, :call_symbol => cs, :player => player}
|
144
162
|
end
|
@@ -1587,12 +1605,12 @@ describe HandStatistics do
|
|
1587
1605
|
register_check @bb
|
1588
1606
|
register_bet @button, 2
|
1589
1607
|
["sb", "bb", "button"].each do |player|
|
1590
|
-
@stats.
|
1591
|
-
@stats.
|
1592
|
-
@stats.
|
1593
|
-
@stats.
|
1594
|
-
@stats.
|
1595
|
-
@stats.
|
1608
|
+
@stats.f_cbet(player).should be_nil
|
1609
|
+
@stats.c_f_cbet(player).should be_nil
|
1610
|
+
@stats.f2_f_cbet(player).should be_nil
|
1611
|
+
@stats.f_dbet(player).should be_nil
|
1612
|
+
@stats.c_f_dbet(player).should be_nil
|
1613
|
+
@stats.f2_f_dbet(player).should be_nil
|
1596
1614
|
end
|
1597
1615
|
@stats.should have_consistent_street_bet_statistics
|
1598
1616
|
end
|
@@ -1614,22 +1632,22 @@ describe HandStatistics do
|
|
1614
1632
|
end
|
1615
1633
|
end
|
1616
1634
|
it "should correctly compute cbet stats" do
|
1617
|
-
[:
|
1618
|
-
@stats.send("
|
1619
|
-
@stats.send("
|
1620
|
-
@stats.send("
|
1621
|
-
@stats.send("
|
1622
|
-
@stats.send("
|
1623
|
-
@stats.send("
|
1624
|
-
@stats.send("
|
1625
|
-
@stats.send("
|
1626
|
-
@stats.send("
|
1627
|
-
@stats.send("
|
1628
|
-
@stats.send("
|
1629
|
-
@stats.send("
|
1635
|
+
[:f, :t, :r].each do |street|
|
1636
|
+
@stats.send("#{street}_cbet", "sb").should be_nil
|
1637
|
+
@stats.send("#{street}_cbet", "bb").should be_nil
|
1638
|
+
@stats.send("#{street}_cbet", "button").should be_true
|
1639
|
+
@stats.send("c_#{street}_cbet", "sb").should be_true
|
1640
|
+
@stats.send("c_#{street}_cbet", "bb").should be_false
|
1641
|
+
@stats.send("c_#{street}_cbet", "button").should be_nil
|
1642
|
+
@stats.send("f2_#{street}_cbet", "sb").should be_false
|
1643
|
+
@stats.send("f2_#{street}_cbet", "bb").should be_true
|
1644
|
+
@stats.send("f2_#{street}_cbet", "button").should be_nil
|
1645
|
+
@stats.send("#{street}_dbet", "sb").should be_false
|
1646
|
+
@stats.send("#{street}_dbet", "bb").should be_false
|
1647
|
+
@stats.send("#{street}_dbet", "button").should be_nil
|
1630
1648
|
[:sb, :bb, :button].each do |player|
|
1631
|
-
@stats.send("
|
1632
|
-
@stats.send("
|
1649
|
+
@stats.send("c_#{street}_dbet", "sb").should be_nil
|
1650
|
+
@stats.send("f2_#{street}_dbet", "bb").should be_nil
|
1633
1651
|
end
|
1634
1652
|
@stats.should have_consistent_street_bet_statistics
|
1635
1653
|
end
|
@@ -1653,21 +1671,21 @@ describe HandStatistics do
|
|
1653
1671
|
end
|
1654
1672
|
end
|
1655
1673
|
it "should correctly compute cbet stats" do
|
1656
|
-
[:
|
1674
|
+
[:f, :t, :r].each do |street|
|
1657
1675
|
[:sb, :bb, :button].each do |player|
|
1658
|
-
@stats.send("
|
1659
|
-
@stats.send("
|
1660
|
-
@stats.send("
|
1676
|
+
@stats.send("#{street}_cbet", player).should be_nil
|
1677
|
+
@stats.send("c_#{street}_cbet", player).should be_nil
|
1678
|
+
@stats.send("f2_#{street}_cbet", player).should be_nil
|
1661
1679
|
end
|
1662
|
-
@stats.send("
|
1663
|
-
@stats.send("
|
1664
|
-
@stats.send("
|
1665
|
-
@stats.send("
|
1666
|
-
@stats.send("
|
1667
|
-
@stats.send("
|
1668
|
-
@stats.send("
|
1669
|
-
@stats.send("
|
1670
|
-
@stats.send("
|
1680
|
+
@stats.send("#{street}_dbet", "sb").should be_false
|
1681
|
+
@stats.send("#{street}_dbet", "bb").should be_true
|
1682
|
+
@stats.send("#{street}_dbet", "button").should be_nil
|
1683
|
+
@stats.send("c_#{street}_dbet", "sb").should be_nil
|
1684
|
+
@stats.send("c_#{street}_dbet", "bb").should be_nil
|
1685
|
+
@stats.send("c_#{street}_dbet", "button").should be_false
|
1686
|
+
@stats.send("f2_#{street}_dbet", "sb").should be_nil
|
1687
|
+
@stats.send("f2_#{street}_dbet", "bb").should be_nil
|
1688
|
+
@stats.send("f2_#{street}_dbet", "button").should be_false
|
1671
1689
|
@stats.should have_consistent_street_bet_statistics
|
1672
1690
|
end
|
1673
1691
|
end
|
@@ -1691,22 +1709,22 @@ describe HandStatistics do
|
|
1691
1709
|
end
|
1692
1710
|
end
|
1693
1711
|
it "should correctly compute cbet stats" do
|
1694
|
-
[:
|
1695
|
-
@stats.send("
|
1696
|
-
@stats.send("
|
1697
|
-
@stats.send("
|
1698
|
-
@stats.send("
|
1699
|
-
@stats.send("
|
1700
|
-
@stats.send("
|
1701
|
-
@stats.send("
|
1702
|
-
@stats.send("
|
1703
|
-
@stats.send("
|
1704
|
-
@stats.send("
|
1705
|
-
@stats.send("
|
1706
|
-
@stats.send("
|
1712
|
+
[:f, :t, :r].each do |street|
|
1713
|
+
@stats.send("#{street}_cbet", "sb").should be_nil
|
1714
|
+
@stats.send("#{street}_cbet", "bb").should be_true
|
1715
|
+
@stats.send("#{street}_cbet", "button").should be_nil
|
1716
|
+
@stats.send("c_#{street}_cbet", "sb").should be_false
|
1717
|
+
@stats.send("c_#{street}_cbet", "bb").should be_nil
|
1718
|
+
@stats.send("c_#{street}_cbet", "button").should be_true
|
1719
|
+
@stats.send("f2_#{street}_cbet", "sb").should be_true
|
1720
|
+
@stats.send("f2_#{street}_cbet", "bb").should be_nil
|
1721
|
+
@stats.send("f2_#{street}_cbet", "button").should be_false
|
1722
|
+
@stats.send("#{street}_dbet", "sb").should be_false
|
1723
|
+
@stats.send("#{street}_dbet", "bb").should be_nil
|
1724
|
+
@stats.send("#{street}_dbet", "button").should be_nil
|
1707
1725
|
[:sb, :bb, :button].each do |player|
|
1708
|
-
@stats.send("
|
1709
|
-
@stats.send("
|
1726
|
+
@stats.send("c_#{street}_dbet", "sb").should be_nil
|
1727
|
+
@stats.send("f2_#{street}_dbet", "bb").should be_nil
|
1710
1728
|
end
|
1711
1729
|
@stats.should have_consistent_street_bet_statistics
|
1712
1730
|
end
|
@@ -1725,18 +1743,18 @@ describe HandStatistics do
|
|
1725
1743
|
end
|
1726
1744
|
|
1727
1745
|
it "correctly compute cbet stats" do
|
1728
|
-
@stats.
|
1729
|
-
@stats.
|
1730
|
-
@stats.
|
1746
|
+
@stats.f_cbet("sb").should be_nil
|
1747
|
+
@stats.f_cbet("bb").should be_nil
|
1748
|
+
@stats.f_cbet("button").should be_false
|
1731
1749
|
["sb", "bb", "button"].each do |player|
|
1732
|
-
@stats.send("
|
1733
|
-
@stats.send("
|
1750
|
+
@stats.send("c_f_cbet", player).should be_nil
|
1751
|
+
@stats.send("f2_f_cbet", player).should be_nil
|
1734
1752
|
end
|
1735
|
-
@stats.
|
1736
|
-
@stats.
|
1737
|
-
@stats.
|
1753
|
+
@stats.f_dbet("sb").should be_false
|
1754
|
+
@stats.f_dbet("bb").should be_false
|
1755
|
+
@stats.f_dbet("button").should be_nil
|
1738
1756
|
[:sb, :bb, :button].each do |player|
|
1739
|
-
@stats.
|
1757
|
+
@stats.f_dbet(player).should be_nil
|
1740
1758
|
end
|
1741
1759
|
@stats.should have_consistent_street_bet_statistics
|
1742
1760
|
end
|
@@ -1757,18 +1775,18 @@ describe HandStatistics do
|
|
1757
1775
|
end
|
1758
1776
|
|
1759
1777
|
it "correctly compute cbet stats" do
|
1760
|
-
@stats.
|
1761
|
-
@stats.
|
1762
|
-
@stats.
|
1778
|
+
@stats.t_cbet("sb").should be_nil
|
1779
|
+
@stats.t_cbet("bb").should be_nil
|
1780
|
+
@stats.t_cbet("button").should be_false
|
1763
1781
|
["sb", "bb", "button"].each do |player|
|
1764
|
-
@stats.send("
|
1765
|
-
@stats.send("
|
1782
|
+
@stats.send("c_t_cbet", player).should be_nil
|
1783
|
+
@stats.send("f2_t_cbet", player).should be_nil
|
1766
1784
|
end
|
1767
|
-
@stats.
|
1768
|
-
@stats.
|
1769
|
-
@stats.
|
1785
|
+
@stats.t_dbet("sb").should be_false
|
1786
|
+
@stats.t_dbet("bb").should be_false
|
1787
|
+
@stats.t_dbet("button").should be_nil
|
1770
1788
|
[:sb, :bb, :button].each do |player|
|
1771
|
-
@stats.
|
1789
|
+
@stats.t_dbet(player).should be_nil
|
1772
1790
|
end
|
1773
1791
|
@stats.should have_consistent_street_bet_statistics
|
1774
1792
|
end
|
@@ -1789,18 +1807,18 @@ describe HandStatistics do
|
|
1789
1807
|
end
|
1790
1808
|
|
1791
1809
|
it "correctly compute cbet stats" do
|
1792
|
-
@stats.
|
1793
|
-
@stats.
|
1794
|
-
@stats.
|
1810
|
+
@stats.r_cbet("sb").should be_nil
|
1811
|
+
@stats.r_cbet("bb").should be_nil
|
1812
|
+
@stats.r_cbet("button").should be_false
|
1795
1813
|
["sb", "bb", "button"].each do |player|
|
1796
|
-
@stats.send("
|
1797
|
-
@stats.send("
|
1814
|
+
@stats.send("c_r_cbet", player).should be_nil
|
1815
|
+
@stats.send("f2_r_cbet", player).should be_nil
|
1798
1816
|
end
|
1799
|
-
@stats.
|
1800
|
-
@stats.
|
1801
|
-
@stats.
|
1817
|
+
@stats.r_dbet("sb").should be_false
|
1818
|
+
@stats.r_dbet("bb").should be_false
|
1819
|
+
@stats.r_dbet("button").should be_nil
|
1802
1820
|
[:sb, :bb, :button].each do |player|
|
1803
|
-
@stats.
|
1821
|
+
@stats.r_dbet(player).should be_nil
|
1804
1822
|
end
|
1805
1823
|
@stats.should have_consistent_street_bet_statistics
|
1806
1824
|
end
|
@@ -1892,26 +1910,25 @@ describe HandStatistics do
|
|
1892
1910
|
|
1893
1911
|
it "should report street bet statistics for each player" do
|
1894
1912
|
report_items = [
|
1895
|
-
:
|
1896
|
-
:
|
1897
|
-
:
|
1898
|
-
:
|
1899
|
-
:
|
1900
|
-
:
|
1901
|
-
:
|
1902
|
-
:
|
1903
|
-
:
|
1904
|
-
:
|
1905
|
-
:
|
1913
|
+
:p_2bet, :p_2bet_o,:p_3bet, :p_3bet_o,:p_4bet, :p_4bet_o, :p_5bet_o,
|
1914
|
+
:f_1bet, :f_1bet_o,:f_2bet, :f_2bet_o,:f_3bet, :f_3bet_o,:f_4bet, :f_4bet_o, :f_5bet_o,
|
1915
|
+
:t_1bet, :t_1bet_o,:t_2bet, :t_2bet_o,:t_3bet, :t_3bet_o,:t_4bet, :t_4bet_o, :t_5bet_o,
|
1916
|
+
:r_1bet, :r_1bet_o,:r_2bet, :r_2bet_o,:r_3bet, :r_3bet_o,:r_4bet, :r_4bet_o, :r_5bet_o,
|
1917
|
+
:c_f_1bet, :c_f_2bet, :c_f_3bet, :c_f_4bet,
|
1918
|
+
:c_t_1bet, :c_t_2bet, :c_t_3bet, :c_t_4bet,
|
1919
|
+
:c_r_1bet, :c_r_2bet, :c_r_3bet, :c_r_4bet,
|
1920
|
+
:f2_p_1bet, :f2_p_2bet, :f2_p_3bet, :f2_p_4bet,
|
1921
|
+
:f2_f_1bet, :f2_f_2bet, :f2_f_3bet, :f2_f_4bet,
|
1922
|
+
:f2_t_1bet, :f2_t_2bet, :f2_t_3bet, :f2_t_4bet,
|
1923
|
+
:f2_r_1bet, :f2_r_2bet, :f2_r_3bet, :f2_r_4bet,
|
1906
1924
|
:last_aggr_preflop, :last_aggr_flop, :last_aggr_turn, :last_aggr_river,
|
1907
|
-
:
|
1908
|
-
:
|
1909
|
-
:
|
1910
|
-
:
|
1911
|
-
:
|
1912
|
-
:
|
1925
|
+
:f_cbet, :f_cbet_o,:t_cbet, :t_cbet_o,:r_cbet,
|
1926
|
+
:c_f_cbet, :c_f_cbet_o,:c_t_cbet, :c_t_cbet_o,:c_r_cbet,
|
1927
|
+
:f2_f_cbet, :f2_f_cbet_o,:f2_t_cbet, :f2_t_cbet_o,:f2_r_cbet,
|
1928
|
+
:f_dbet, :f_dbet_o,:t_dbet, :t_dbet_o,:r_dbet,
|
1929
|
+
:c_f_dbet, :c_f_dbet_o,:c_t_dbet, :c_t_dbet_o,:c_r_dbet,
|
1930
|
+
:f2_f_dbet, :f2_f_dbet_o,:f2_t_dbet, :f2_t_dbet_o,:f2_r_dbet,:f2_r_dbet_o
|
1913
1931
|
]
|
1914
|
-
report_items.each{|report_item| @street_bet_plugin.should_receive(report_item).exactly(@stats.players.size)}
|
1915
1932
|
@reports = @stats.reports
|
1916
1933
|
report_items.each{|report_item|@stats.players.each{|each| @reports[each].should include(report_item)}}
|
1917
1934
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
require '
|
2
|
+
require 'active_support'
|
3
3
|
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
4
4
|
require File.expand_path(File.dirname(__FILE__) + '/../lib/pokerstats/hand_statistics')
|
5
5
|
require File.expand_path(File.dirname(__FILE__) + '/../lib/pokerstats/player_statistics')
|
@@ -7,54 +7,44 @@ include Pokerstats
|
|
7
7
|
|
8
8
|
TEST = [
|
9
9
|
{"andy" => {
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
:call_cbet_flop => true,
|
29
|
-
:fold_to_cbet_flop => true,
|
30
|
-
:preflop_3bet => true,
|
31
|
-
:call_preflop_3bet => true,
|
32
|
-
:fold_to_preflop_3bet => true
|
10
|
+
:is_blind_attack_opportunity => false,
|
11
|
+
:is_blind_attack_opportunity_taken => nil,
|
12
|
+
:is_blind_defense_opportunity => false,
|
13
|
+
:is_blind_defense_opportunity_taken => nil,
|
14
|
+
:posted => 1,
|
15
|
+
:paid => 2,
|
16
|
+
:won => 3,
|
17
|
+
:cards => nil,
|
18
|
+
:preflop_passive => 1,
|
19
|
+
:preflop_aggressive => 2,
|
20
|
+
:postflop_passive => 3,
|
21
|
+
:postflop_aggressive => 4,
|
22
|
+
:is_pfr_opportunity => true,
|
23
|
+
:is_pfr_opportunity_taken => true,
|
24
|
+
:f_cbet => true,
|
25
|
+
:f_cbet_o => true,
|
26
|
+
:p_3bet => true,
|
27
|
+
:p_3bet_o => true
|
33
28
|
},
|
34
29
|
"judi" => {
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
:call_cbet_flop => true,
|
54
|
-
:fold_to_cbet_flop => true,
|
55
|
-
:preflop_3bet => true,
|
56
|
-
:call_preflop_3bet => true,
|
57
|
-
:fold_to_preflop_3bet => true
|
30
|
+
:is_blind_attack_opportunity => true,
|
31
|
+
:is_blind_attack_opportunity_taken => false,
|
32
|
+
:is_blind_defense_opportunity => true,
|
33
|
+
:is_blind_defense_opportunity_taken => true,
|
34
|
+
:posted => 10,
|
35
|
+
:paid => 20,
|
36
|
+
:won => 30,
|
37
|
+
:cards => nil,
|
38
|
+
:preflop_passive => 10,
|
39
|
+
:preflop_aggressive => 20,
|
40
|
+
:postflop_passive => 30,
|
41
|
+
:postflop_aggressive => 40,
|
42
|
+
:is_pfr_opportunity => true,
|
43
|
+
:is_pfr_opportunity_taken => false,
|
44
|
+
:f_cbet => false,
|
45
|
+
:f_cbet_o => true,
|
46
|
+
:p_3bet => false,
|
47
|
+
:p_3bet_o => true
|
58
48
|
}
|
59
49
|
},
|
60
50
|
{"andy" => {
|
@@ -62,8 +52,6 @@ TEST = [
|
|
62
52
|
:is_blind_attack_opportunity_taken => nil,
|
63
53
|
:is_blind_defense_opportunity => false,
|
64
54
|
:is_blind_defense_opportunity_taken => nil,
|
65
|
-
:is_cbet_opportunity => true,
|
66
|
-
:is_cbet_opportunity_taken => false,
|
67
55
|
:posted => 2,
|
68
56
|
:paid => 4,
|
69
57
|
:won => 6,
|
@@ -74,89 +62,71 @@ TEST = [
|
|
74
62
|
:postflop_aggressive => 8,
|
75
63
|
:is_pfr_opportunity => true,
|
76
64
|
:is_pfr_opportunity_taken => true,
|
77
|
-
:
|
78
|
-
:
|
79
|
-
|
80
|
-
|
81
|
-
:preflop_3bet => true,
|
82
|
-
:call_preflop_3bet => true,
|
83
|
-
:fold_to_preflop_3bet => true
|
65
|
+
:f_cbet => false,
|
66
|
+
:f_cbet_o => true,
|
67
|
+
:p_3bet => true,
|
68
|
+
:p_3bet_o => true
|
84
69
|
},
|
85
70
|
"judi" => {
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
:call_cbet_flop => true,
|
105
|
-
:fold_to_cbet_flop => true,
|
106
|
-
:preflop_3bet => true,
|
107
|
-
:call_preflop_3bet => true,
|
108
|
-
:fold_to_preflop_3bet => true
|
71
|
+
:is_blind_attack_opportunity => true,
|
72
|
+
:is_blind_attack_opportunity_taken => false,
|
73
|
+
:is_blind_defense_opportunity => true,
|
74
|
+
:is_blind_defense_opportunity_taken => true,
|
75
|
+
:posted => 20,
|
76
|
+
:paid => 30,
|
77
|
+
:won => 40,
|
78
|
+
:cards => nil,
|
79
|
+
:preflop_passive => 20,
|
80
|
+
:preflop_aggressive => 40,
|
81
|
+
:postflop_passive => 60,
|
82
|
+
:postflop_aggressive => 80,
|
83
|
+
:is_pfr_opportunity => true,
|
84
|
+
:is_pfr_opportunity_taken => false,
|
85
|
+
:f_cbet => false,
|
86
|
+
:f_cbet_o => false,
|
87
|
+
:p_3bet => false,
|
88
|
+
:p_3bet_o => true
|
109
89
|
}
|
110
90
|
},
|
111
91
|
{"andy" => {
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
:call_cbet_flop => true,
|
131
|
-
:fold_to_cbet_flop => true,
|
132
|
-
:preflop_3bet => true,
|
133
|
-
:call_preflop_3bet => true,
|
134
|
-
:fold_to_preflop_3bet => true
|
92
|
+
:is_blind_attack_opportunity => false,
|
93
|
+
:is_blind_attack_opportunity_taken => nil,
|
94
|
+
:is_blind_defense_opportunity => true,
|
95
|
+
:is_blind_defense_opportunity_taken => false,
|
96
|
+
:posted => 3,
|
97
|
+
:paid => 6,
|
98
|
+
:won => 9,
|
99
|
+
:cards => nil,
|
100
|
+
:preflop_passive => 3,
|
101
|
+
:preflop_aggressive => 6,
|
102
|
+
:postflop_passive => 9,
|
103
|
+
:postflop_aggressive => 12,
|
104
|
+
:is_pfr_opportunity => true,
|
105
|
+
:is_pfr_opportunity_taken => true,
|
106
|
+
:f_cbet => false,
|
107
|
+
:f_cbet_o => false,
|
108
|
+
:p_3bet => true,
|
109
|
+
:p_3bet_o => true
|
135
110
|
},
|
136
111
|
"judi" => {
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
:call_cbet_flop => true,
|
156
|
-
:fold_to_cbet_flop => true,
|
157
|
-
:preflop_3bet => true,
|
158
|
-
:call_preflop_3bet => true,
|
159
|
-
:fold_to_preflop_3bet => true
|
112
|
+
:is_blind_attack_opportunity => true,
|
113
|
+
:is_blind_attack_opportunity_taken => true,
|
114
|
+
:is_blind_defense_opportunity => true,
|
115
|
+
:is_blind_defense_opportunity_taken => true,
|
116
|
+
:posted => 30,
|
117
|
+
:paid => 0,
|
118
|
+
:won => 0,
|
119
|
+
:cards => nil,
|
120
|
+
:preflop_passive => 30,
|
121
|
+
:preflop_aggressive => 60,
|
122
|
+
:postflop_passive => 90,
|
123
|
+
:postflop_aggressive => 120,
|
124
|
+
:is_pfr_opportunity => true,
|
125
|
+
:is_pfr_opportunity_taken => false,
|
126
|
+
:f_cbet => false,
|
127
|
+
:f_cbet_o => false,
|
128
|
+
:p_3bet => false,
|
129
|
+
:p_3bet_o => true
|
160
130
|
}
|
161
131
|
}
|
162
132
|
]
|
@@ -172,18 +142,16 @@ PS_RESULT = {
|
|
172
142
|
:t_blind_attack_opportunity_taken => 0,
|
173
143
|
:t_blind_defense_opportunity => 1,
|
174
144
|
:t_blind_defense_opportunity_taken => 0,
|
175
|
-
:t_cbet_opportunity => 2,
|
176
|
-
:t_cbet_opportunity_taken => 1,
|
177
145
|
:t_preflop_passive => 6,
|
178
146
|
:t_preflop_aggressive => 12,
|
179
147
|
:t_postflop_passive => 18,
|
180
148
|
:t_postflop_aggressive => 24,
|
181
149
|
:t_pfr_opportunity => 3,
|
182
150
|
:t_pfr_opportunity_taken => 3,
|
183
|
-
:
|
184
|
-
:
|
185
|
-
:
|
186
|
-
:
|
151
|
+
:t_p_3bet => 3,
|
152
|
+
:t_p_3bet_o => 3,
|
153
|
+
:t_f_cbet => 1,
|
154
|
+
:t_f_cbet_o => 2
|
187
155
|
},
|
188
156
|
"judi" => {
|
189
157
|
:t_hands => 3,
|
@@ -195,18 +163,16 @@ PS_RESULT = {
|
|
195
163
|
:t_blind_attack_opportunity_taken => 1,
|
196
164
|
:t_blind_defense_opportunity => 3,
|
197
165
|
:t_blind_defense_opportunity_taken => 3,
|
198
|
-
:t_cbet_opportunity => 1,
|
199
|
-
:t_cbet_opportunity_taken => 0,
|
200
166
|
:t_preflop_passive => 60,
|
201
167
|
:t_preflop_aggressive => 120,
|
202
168
|
:t_postflop_passive => 180,
|
203
169
|
:t_postflop_aggressive => 240,
|
204
170
|
:t_pfr_opportunity => 3,
|
205
171
|
:t_pfr_opportunity_taken => 0,
|
206
|
-
:
|
207
|
-
:
|
208
|
-
:
|
209
|
-
:
|
172
|
+
:t_p_3bet => 0,
|
173
|
+
:t_p_3bet_o => 3,
|
174
|
+
:t_f_cbet => 0,
|
175
|
+
:t_f_cbet_o => 1
|
210
176
|
}
|
211
177
|
}
|
212
178
|
|
@@ -219,12 +185,18 @@ class AggregateTo
|
|
219
185
|
|
220
186
|
def matches?(hash)
|
221
187
|
@actual = hash[@player][@stat]
|
188
|
+
@hash = hash
|
222
189
|
# Satisfy expectation here. Return false or raise an error if it's not met.
|
223
|
-
|
190
|
+
# puts "trying to match #{@stat}[#{@player}] expected #{@expected.inspect}, got #{@actual.inspect}"
|
191
|
+
return hash[@player].keys.include?(@stat) && @actual == @expected
|
224
192
|
end
|
225
193
|
|
226
194
|
def failure_message
|
227
|
-
|
195
|
+
if @hash[@player].keys.include?(@stat)
|
196
|
+
"expected report[#{@player.inspect}][#{@stat.inspect}] to aggregate to #{@expected.inspect}, got #{@actual.inspect}"
|
197
|
+
else
|
198
|
+
"expected report to include #{@stat}"
|
199
|
+
end
|
228
200
|
end
|
229
201
|
|
230
202
|
def negative_failure_message
|
@@ -271,13 +243,10 @@ describe PlayerStatistics, "when aggregating statistics" do
|
|
271
243
|
it 'should correctly aggregate cash statistics' do
|
272
244
|
should_correctly_aggregate @reports, [:t_hands, :t_vpip, :t_posted, :t_paid, :t_won]
|
273
245
|
end
|
274
|
-
it 'should correctly aggregate continuation bet statistics' do
|
275
|
-
should_correctly_aggregate @reports, [:t_cbet_opportunity, :t_cbet_opportunity_taken]
|
276
|
-
end
|
277
246
|
it 'should correctly aggregate preflop raise statistics' do
|
278
247
|
should_correctly_aggregate @reports, [:t_pfr_opportunity, :t_pfr_opportunity_taken]
|
279
248
|
end
|
280
249
|
it 'should correctly aggregate ternary statistics' do
|
281
|
-
should_correctly_aggregate @reports, [:
|
250
|
+
should_correctly_aggregate @reports, [:t_p_3bet, :t_p_3bet_o, :t_f_cbet, :t_f_cbet_o]
|
282
251
|
end
|
283
252
|
end
|