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