Class: Bridge::Points::Chicago
- Inherits:
-
Object
- Object
- Bridge::Points::Chicago
- Defined in:
- lib/bridge/constants.rb,
lib/bridge/points/chicago.rb
Constant Summary collapse
- POINTS =
values in array: [not-vulnerable, vulnerable]
{ 20 => [0, 0], 21 => [50, 50], 22 => [70, 70], 23 => [110, 110], 24 => [200, 290], 25 => [300, 440], 26 => [350, 520], 27 => [400, 600], 28 => [430, 630], 29 => [460, 660], 30 => [490, 690], 31 => [600, 900], 32 => [700, 1050], 33 => [900, 1350], 34 => [1000, 1500], 35 => [1100, 1650], 36 => [1200, 1800], 37 => [1300, 1950], 38 => [1300, 1950], 39 => [1300, 1950], 40 => [1300, 1950] }
Instance Attribute Summary collapse
-
#hcp ⇒ Object
readonly
Returns the value of attribute hcp.
-
#points ⇒ Object
readonly
Returns the value of attribute points.
-
#vulnerable ⇒ Object
(also: #vulnerable?)
readonly
Returns the value of attribute vulnerable.
Instance Method Summary collapse
-
#imps ⇒ Object
Returns imps (negative or positive) based on given points.
-
#initialize(options = {}) ⇒ Chicago
constructor
Creates new Imp object.
-
#points_difference ⇒ Object
Returns points score relative to hcp.
-
#points_to_make ⇒ Object
Returns points that side should make with given hcp.
Constructor Details
#initialize(options = {}) ⇒ Chicago
10 11 12 13 14 15 |
# File 'lib/bridge/points/chicago.rb', line 10 def initialize( = {}) @hcp = [:hcp] raise ArgumentError, "Invalid hcp: #{hcp} - value should be between 20 and 40" unless (20..40).include?(hcp) @points = [:points] @vulnerable = [:vulnerable] || false end |
Instance Attribute Details
#hcp ⇒ Object (readonly)
Returns the value of attribute hcp.
3 4 5 |
# File 'lib/bridge/points/chicago.rb', line 3 def hcp @hcp end |
#points ⇒ Object (readonly)
Returns the value of attribute points.
3 4 5 |
# File 'lib/bridge/points/chicago.rb', line 3 def points @points end |
#vulnerable ⇒ Object (readonly) Also known as: vulnerable?
Returns the value of attribute vulnerable.
3 4 5 |
# File 'lib/bridge/points/chicago.rb', line 3 def vulnerable @vulnerable end |
Instance Method Details
#imps ⇒ Object
Returns imps (negative or positive) based on given points
28 29 30 |
# File 'lib/bridge/points/chicago.rb', line 28 def imps Bridge::Points.imps(points_difference) end |
#points_difference ⇒ Object
Returns points score relative to hcp
23 24 25 |
# File 'lib/bridge/points/chicago.rb', line 23 def points_difference points - points_to_make end |
#points_to_make ⇒ Object
Returns points that side should make with given hcp
18 19 20 |
# File 'lib/bridge/points/chicago.rb', line 18 def points_to_make POINTS[hcp][vulnerable? ? 1 : 0] end |