Sha256: b71bf5071c70d06e876146e64e9e19d6a48a7af045e315753030540715cf93ce

Contents?: true

Size: 1.53 KB

Versions: 19

Compression:

Stored size: 1.53 KB

Contents

class AggressionStatistics < HandStatistics::Plugin

  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

  def initialize handstatistics
    super handstatistics
    @preflop_passive = {}
    @preflop_aggressive = {}
    @postflop_passive = {}
    @postflop_aggressive = {}
  end
    
  def preflop_passive(screen_name)
    @preflop_passive[screen_name]
  end
  
  def postflop_passive(screen_name)
    @postflop_passive[screen_name]
  end
  
  def preflop_aggressive(screen_name)
    @preflop_aggressive[screen_name]
  end
  
  def postflop_aggressive(screen_name)
    @postflop_aggressive[screen_name]
  end

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

  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
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
wizardwerdna-pokerstats-0.4.0 lib/pokerstats/plugins/aggression_statistics.rb
wizardwerdna-pokerstats-0.5.0 lib/pokerstats/plugins/aggression_statistics.rb
wizardwerdna-pokerstats-0.6.0 lib/pokerstats/plugins/aggression_statistics.rb
wizardwerdna-pokerstats-0.7.0 lib/pokerstats/plugins/aggression_statistics.rb
wizardwerdna-pokerstats-0.8.0 lib/pokerstats/plugins/aggression_statistics.rb
wizardwerdna-pokerstats-0.8.1 lib/pokerstats/plugins/aggression_statistics.rb
wizardwerdna-pokerstats-0.8.2 lib/pokerstats/plugins/aggression_statistics.rb
wizardwerdna-pokerstats-0.9.0 lib/pokerstats/plugins/aggression_statistics.rb
wizardwerdna-pokerstats-1.0.0 lib/pokerstats/plugins/aggression_statistics.rb
wizardwerdna-pokerstats-1.0.10 lib/pokerstats/plugins/aggression_statistics.rb
wizardwerdna-pokerstats-1.0.11 lib/pokerstats/plugins/aggression_statistics.rb
wizardwerdna-pokerstats-1.0.12 lib/pokerstats/plugins/aggression_statistics.rb
wizardwerdna-pokerstats-1.0.13 lib/pokerstats/plugins/aggression_statistics.rb
wizardwerdna-pokerstats-1.0.14 lib/pokerstats/plugins/aggression_statistics.rb
wizardwerdna-pokerstats-1.0.2 lib/pokerstats/plugins/aggression_statistics.rb
wizardwerdna-pokerstats-1.0.5 lib/pokerstats/plugins/aggression_statistics.rb
wizardwerdna-pokerstats-1.0.6 lib/pokerstats/plugins/aggression_statistics.rb
wizardwerdna-pokerstats-1.0.7 lib/pokerstats/plugins/aggression_statistics.rb
wizardwerdna-pokerstats-1.0.9 lib/pokerstats/plugins/aggression_statistics.rb