Class: Pokerstats::AggressionStatistics

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(handstatistics) ⇒ AggressionStatistics

Returns a new instance of AggressionStatistics.



14
15
16
17
18
19
20
# File 'lib/pokerstats/plugins/aggression_statistics.rb', line 14

def initialize handstatistics
  super handstatistics
  @preflop_passive = {}
  @preflop_aggressive = {}
  @postflop_passive = {}
  @postflop_aggressive = {}
end

Class Method Details

.report_specificationObject



4
5
6
7
8
9
10
11
12
# File 'lib/pokerstats/plugins/aggression_statistics.rb', line 4

def self.report_specification
  [
    # [key,                               sql_type,   function]
    [:preflop_passive,      'integer',  :preflop_passive],
    [:postflop_passive,     'integer',  :postflop_passive],
    [:preflop_aggressive,   'integer',  :preflop_aggressive],
    [:postflop_aggressive,  'integer',  :postflop_aggressive]
  ]
end

Instance Method Details

#apply_action(action, street) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
# File 'lib/pokerstats/plugins/aggression_statistics.rb', line 45

def apply_action action, street
  aggression = action[:aggression]
  player = action[:screen_name]
  if [:prelude, :preflop].member?(street)
    @preflop_aggressive[player] +=1 if aggression == :aggressive
    @preflop_passive[player] += 1 if aggression == :passive
  else
    @postflop_aggressive[player] +=1 if aggression == :aggressive
    @postflop_passive[player] +=1 if aggression == :passive
  end
end

#postflop_aggressive(screen_name) ⇒ Object



34
35
36
# File 'lib/pokerstats/plugins/aggression_statistics.rb', line 34

def postflop_aggressive(screen_name)
  @postflop_aggressive[screen_name]
end

#postflop_passive(screen_name) ⇒ Object



26
27
28
# File 'lib/pokerstats/plugins/aggression_statistics.rb', line 26

def postflop_passive(screen_name)
  @postflop_passive[screen_name]
end

#preflop_aggressive(screen_name) ⇒ Object



30
31
32
# File 'lib/pokerstats/plugins/aggression_statistics.rb', line 30

def preflop_aggressive(screen_name)
  @preflop_aggressive[screen_name]
end

#preflop_passive(screen_name) ⇒ Object



22
23
24
# File 'lib/pokerstats/plugins/aggression_statistics.rb', line 22

def preflop_passive(screen_name)
  @preflop_passive[screen_name]
end

#register_player(screen_name, street, player) ⇒ Object



38
39
40
41
42
43
# File 'lib/pokerstats/plugins/aggression_statistics.rb', line 38

def register_player screen_name, street, player
  @preflop_passive[screen_name] = 0
  @preflop_aggressive[screen_name] = 0
  @postflop_passive[screen_name] = 0
  @postflop_aggressive[screen_name] = 0
end