Sha256: d3fe3cd80b592b41090dfbff1f426bcf4989e6da2c40a57c1f12daca2cbbd994

Contents?: true

Size: 1.41 KB

Versions: 19

Compression:

Stored size: 1.41 KB

Contents

class PreflopRaiseStatistics < HandStatistics::Plugin

  def initialize handstatistics
    super handstatistics
    @pfr_opportunity = {}
    @pfr_opportunity_taken = {}
    @pfr_size_in_bb = {}
  end
  
  def pfr_opportunity?(screen_name)
    @pfr_opportunity[screen_name]
  end
  
  def pfr_opportunity_taken?(screen_name)
    @pfr_opportunity[screen_name] && @pfr_opportunity_taken[screen_name]
  end
  
  def self.report_specification
    [
      # [key,                     sql_type,   function]
      [:is_pfr_opportunity,       'integer',  :pfr_opportunity?],
      [:is_pfr_opportunity_taken, 'integer',  :pfr_opportunity_taken?]
    ]
  end
    
  # def report screen_name
  #   {
  #     :is_pfr_opportunity => pfr_opportunity?(screen_name),
  #     :is_pfr_opportunity_taken => pfr_opportunity_taken?(screen_name)
  #   }
  # end
  
  def apply_action action, street
    # puts "pfr: apply_action #{street}, #{action.inspect}"
    result = action[:result]
    player = action[:screen_name]
    if street == :preflop and [:pay, :pay_to, :neutral].member?(result) and @pfr_opportunity[player].nil?
      case result
      when :pay, :neutral
        @pfr_opportunity[player] = true
        @pfr_opportunity_taken[player] = false
      when :pay_to
        @hand_statistics.players.each {|each_player| @pfr_opportunity[each_player] ||= (each_player == player)}
        @pfr_opportunity_taken[player] = true
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

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