Class: Bridge::RubberResult
Overview
Represents the result of a completed round of rubber bridge.
Constant Summary
Constants inherited from Result
Instance Attribute Summary
Attributes inherited from Result
#board, #claimed, #claimed_by, #contract, #contract_level, #is_doubled, #is_major, #is_redoubled, #is_vulnerable, #score, #tricks_made, #tricks_required, #trump_suit
Instance Method Summary collapse
-
#_get_score ⇒ Object
Rubber bridge scoring scheme.
Methods inherited from Result
#_get_score_components, #initialize, #to_a
Constructor Details
This class inherits a constructor from Bridge::Result
Instance Method Details
#_get_score ⇒ Object
Rubber bridge scoring scheme. @return: 2-tuple of numeric scores (above the line, below the line): positive for declarer, negative for defenders.
224 225 226 227 228 229 230 231 232 233 234 235 236 237 |
# 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 |