class Bridge::RubberResult

Represents the result of a completed round of rubber bridge.

Public Instance Methods

_get_score() click to toggle source

Rubber bridge scoring scheme. @return: 2-tuple of numeric scores (above the line, below the line): positive for declarer, negative for defenders.

# File lib/bridge/result.rb, line 224
def _get_score
  above, below = 0, 0
  if self.contract and self.tricks_made
    self._get_score_components.items.each do |key, value|
      # Note: gamebonus/partscore are not assigned in rubber bridge.
      if ['over', 'under', 'slambonus', 'insultbonus'].include?(key)
        above += value
      elsif key == 'odd'
        below += value
      end
    end
  end
  return [above, below]
end