Sha256: 4827096c1e8dd6a300920b5f3f5ec3b08ddbff380b0a7aa10d5c75582e3260d6
Contents?: true
Size: 900 Bytes
Versions: 3
Compression:
Stored size: 900 Bytes
Contents
module Bridge::Points class Chicago attr_reader :hcp, :points, :vulnerable alias :vulnerable? :vulnerable # Creates new Imp object # # ==== Example # Bridge::Points::Chicago.new(:hcp => 25, :points => 420, :vulnerable => true) def initialize(options = {}) @hcp = options[:hcp] raise ArgumentError, "Invalid hcp: #{hcp} - value should be between 20 and 40" unless (20..40).include?(hcp) @points = options[:points] @vulnerable = options[:vulnerable] || false end # Returns points that side should make with given hcp def points_to_make POINTS[hcp][vulnerable? ? 1 : 0] end # Returns points score relative to hcp def points_difference points - points_to_make end # Returns imps (negative or positive) based on given points def imps Bridge::Points.imps(points_difference) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bridge-0.2.0 | lib/bridge/points/chicago.rb |
bridge-0.1.4 | lib/bridge/points/chicago.rb |
bridge-0.1.3 | lib/bridge/points/chicago.rb |