Class: Pokerstats::StreetBetStatistics

Inherits:
HandStatistics::Plugin
  • Object
show all
Defined in:
lib/pokerstats/plugins/street_bet_statistics.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(handstatistics) ⇒ StreetBetStatistics

Returns a new instance of StreetBetStatistics.



266
267
268
269
270
271
272
273
274
275
276
277
278
# File 'lib/pokerstats/plugins/street_bet_statistics.rb', line 266

def initialize handstatistics
    @street_bets = {}
    @call_street_bets = {}
    @fold_to_street_bets = {}
    @first_aggr_player = {}
    @last_aggr_player = {}
    [:preflop, :flop, :turn, :river].each do|each|
        @street_bets[each] = [{}, {}, {}, {}, {}, {}] 
        @call_street_bets[each] = [{}, {}, {}, {}, {}]
        @fold_to_street_bets[each] = [{}, {}, {}, {}, {}]
    end
    super handstatistics
end

Instance Attribute Details

#fold_to_street_betsObject

Returns the value of attribute fold_to_street_bets.



119
120
121
# File 'lib/pokerstats/plugins/street_bet_statistics.rb', line 119

def fold_to_street_bets
  @fold_to_street_bets
end

#last_aggr_playerObject

Returns the value of attribute last_aggr_player.



119
120
121
# File 'lib/pokerstats/plugins/street_bet_statistics.rb', line 119

def last_aggr_player
  @last_aggr_player
end

#street_betsObject

Returns the value of attribute street_bets.



119
120
121
# File 'lib/pokerstats/plugins/street_bet_statistics.rb', line 119

def street_bets
  @street_bets
end

Class Method Details

.report_specificationObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/pokerstats/plugins/street_bet_statistics.rb', line 3

def self.report_specification
    [
        [:p_2bet,	"boolean",	:p_2bet?],
        [:p_2bet_o,	"boolean",	:p_2bet_o?],
        [:p_3bet,	"boolean",	:p_3bet?],
        [:p_3bet_o,	"boolean",	:p_3bet_o?],
        [:p_4bet,	"boolean",	:p_4bet?],
        [:p_4bet_o,	"boolean",	:p_4bet_o?],
        [:p_5bet_o,	"boolean",	:p_5bet_o?],
        [:f_1bet,	"boolean",	:f_1bet?],
        [:f_1bet_o,	"boolean",	:f_1bet_o?],
        [:f_2bet,	"boolean",	:f_2bet?],
        [:f_2bet_o,	"boolean",	:f_2bet_o?],
        [:f_3bet,	"boolean",	:f_3bet?],
        [:f_3bet_o,	"boolean",	:f_3bet_o?],
        [:f_4bet,	"boolean",	:f_4bet?],
        [:f_4bet_o,	"boolean",	:f_4bet_o?],
        [:f_5bet_o,	"boolean",	:f_5bet_o?],
        [:t_1bet,	"boolean",	:t_1bet?],
        [:t_1bet_o,	"boolean",	:t_1bet_o?],
        [:t_2bet,	"boolean",	:t_2bet?],
        [:t_2bet_o,	"boolean",	:t_2bet_o?],
        [:t_3bet,	"boolean",	:t_3bet?],
        [:t_3bet_o,	"boolean",	:t_3bet_o?],
        [:t_4bet,	"boolean",	:t_4bet?],
        [:t_4bet_o,	"boolean",	:t_4bet_o?],
        [:t_5bet_o,	"boolean",	:t_5bet_o?],
        [:r_1bet,	"boolean",	:r_1bet?],
        [:r_1bet_o,	"boolean",	:r_1bet_o?],
        [:r_2bet,	"boolean",	:r_2bet?],
        [:r_2bet_o,	"boolean",	:r_2bet_o?],
        [:r_3bet,	"boolean",	:r_3bet?],
        [:r_3bet_o,	"boolean",	:r_3bet_o?],
        [:r_4bet,	"boolean",	:r_4bet?],
        [:r_4bet_o,	"boolean",	:r_4bet_o?],
        [:r_5bet_o,	"boolean",	:r_5bet_o?],

        [:f2_p_1bet,	"boolean",	:f2_p_1bet?],
        [:f2_p_2bet,	"boolean",	:f2_p_2bet?],
        [:f2_p_3bet,	"boolean",	:f2_p_3bet?],
        [:f2_p_4bet,	"boolean",	:f2_p_4bet?],
        [:f2_f_1bet,	"boolean",	:f2_f_1bet?],
        [:f2_f_2bet,	"boolean",	:f2_f_2bet?],
        [:f2_f_3bet,	"boolean",	:f2_f_3bet?],
        [:f2_f_4bet,	"boolean",	:f2_f_4bet?],
        [:f2_t_1bet,	"boolean",	:f2_t_1bet?],
        [:f2_t_2bet,	"boolean",	:f2_t_2bet?],
        [:f2_t_3bet,	"boolean",	:f2_t_3bet?],
        [:f2_t_4bet,	"boolean",	:f2_t_4bet?],
        [:f2_r_1bet,	"boolean",	:f2_r_1bet?],
        [:f2_r_2bet,	"boolean",	:f2_r_2bet?],
        [:f2_r_3bet,	"boolean",	:f2_r_3bet?],
        [:f2_r_4bet,	"boolean",	:f2_r_4bet?],

        [:c_p_1bet,	"boolean",	:c_p_1bet?],
        [:c_p_2bet,	"boolean",	:c_p_2bet?],
        [:c_p_3bet,	"boolean",	:c_p_3bet?],
        [:c_p_4bet,	"boolean",	:c_p_4bet?],
        [:c_f_1bet,	"boolean",	:c_f_1bet?],
        [:c_f_2bet,	"boolean",	:c_f_2bet?],
        [:c_f_3bet,	"boolean",	:c_f_3bet?],
        [:c_f_4bet,	"boolean",	:c_f_4bet?],
        [:c_t_1bet,	"boolean",	:c_t_1bet?],
        [:c_t_2bet,	"boolean",	:c_t_2bet?],
        [:c_t_3bet,	"boolean",	:c_t_3bet?],
        [:c_t_4bet,	"boolean",	:c_t_4bet?],
        [:c_r_1bet,	"boolean",	:c_r_1bet?],
        [:c_r_2bet,	"boolean",	:c_r_2bet?],
        [:c_r_3bet,	"boolean",	:c_r_3bet?],
        [:c_r_4bet,	"boolean",	:c_r_4bet?],

        [:last_aggr_preflop,	'boolean',	:last_aggr_preflop],
        [:last_aggr_flop,	'boolean',	:last_aggr_flop],
        [:last_aggr_turn,	'boolean',	:last_aggr_turn],
        [:last_aggr_river,	'boolean',	:last_aggr_river],

        [:f_cbet,	'boolean',	:f_cbet?],
        [:f_cbet_o,	"boolean",	:f_cbet_o?],
        [:t_cbet,	'boolean',	:t_cbet?],
        [:t_cbet_o,	"boolean",	:t_cbet_o?],
        [:r_cbet,	'boolean',	:r_cbet?],
        [:r_cbet_o,	"boolean",	:r_cbet_o?],
        [:c_f_cbet,	'boolean',	:c_f_cbet?],
        [:c_f_cbet_o,	"boolean",	:c_f_cbet_o?],
        [:c_t_cbet,	'boolean',	:c_t_cbet?],
        [:c_t_cbet_o,	"boolean",	:c_t_cbet_o?],
        [:c_r_cbet,	'boolean',	:c_r_cbet?],
        [:c_r_cbet_o,	"boolean",	:c_r_cbet_o?],
        [:f2_f_cbet,	'boolean',	:f2_f_cbet?],
        [:f2_f_cbet_o,	"boolean",	:f2_f_cbet_o?],
        [:f2_t_cbet,	'boolean',	:f2_t_cbet?],
        [:f2_t_cbet_o,	"boolean",	:f2_t_cbet_o?],
        [:f2_r_cbet,	'boolean',	:f2_r_cbet?],
        [:f2_r_cbet_o,	"boolean",	:f2_r_cbet_o?],

        [:f_dbet,	'boolean',	:f_dbet?],
        [:f_dbet_o,	"boolean",	:f_dbet_o?],
        [:t_dbet,	'boolean',	:t_dbet?],
        [:t_dbet_o,	"boolean",	:t_dbet_o?],
        [:r_dbet,	'boolean',	:r_dbet?],
        [:r_dbet_o,	"boolean",	:r_dbet_o?],
        [:c_f_dbet,	'boolean',	:c_f_dbet?],
        [:c_f_dbet_o,	"boolean",	:c_f_dbet_o?],
        [:c_t_dbet,	'boolean',	:c_t_dbet?],
        [:c_t_dbet_o,	"boolean",	:c_t_dbet_o?],
        [:c_r_dbet,	'boolean',	:c_r_dbet?],
        [:c_r_dbet_o,	"boolean",	:c_r_dbet_o?],
        [:f2_f_dbet,	'boolean',	:f2_f_dbet?],
        [:f2_f_dbet_o,	"boolean",	:f2_f_dbet_o?],
        [:f2_t_dbet,	'boolean',	:f2_t_dbet?],
        [:f2_t_dbet_o,	"boolean",	:f2_t_dbet_o?],
        [:f2_r_dbet,	'boolean',	:f2_r_dbet?],
        [:f2_r_dbet_o,	'boolean',	:f2_r_dbet_o?]
    ]
end

Instance Method Details

#apply_action(action, street) ⇒ Object



297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
# File 'lib/pokerstats/plugins/street_bet_statistics.rb', line 297

def apply_action action, street
    unless @last_bet.nil?
        # puts "apply_action(#{action[:aggression]}, #{street}) with @last_bet == #{@last_bet}"
        if @last_bet.between?(0,4)
            @fold_to_street_bets[street][@last_bet][action[:screen_name]] = action[:description] == "folds"
            @call_street_bets[street][@last_bet][action[:screen_name]] = action[:description] == "calls"
        end
        if @last_bet.between?(0,4)
            @street_bets[street][@last_bet+1][action[:screen_name]] = action[:aggression] == :aggressive
        end
        if action[:aggression] == :aggressive
            @last_bet+=1
            @first_aggr_player[street] ||= action[:screen_name]
            @last_aggr_player[street] = action[:screen_name]
        end
    end
end

#register_player(screen_name, street, player) ⇒ Object



280
281
# File 'lib/pokerstats/plugins/street_bet_statistics.rb', line 280

def register_player screen_name, street, player
end

#street_transition(street) ⇒ Object



283
284
285
286
287
288
289
290
291
292
# File 'lib/pokerstats/plugins/street_bet_statistics.rb', line 283

def street_transition street
    case street
    when :preflop
        @last_bet = 1
    when :flop, :turn, :river
        @last_bet = 0
    else
        @last_bet = nil
    end
end

#street_transition_for_player(street, player) ⇒ Object



294
295
# File 'lib/pokerstats/plugins/street_bet_statistics.rb', line 294

def street_transition_for_player street, player
end