Module: AgbHandicap
- Defined in:
- lib/agb_handicap.rb
Constant Summary collapse
- SCORING_SCHEMES =
{ 'METRIC' => 'Standard WA target face 10 -1', 'IMPERIAL' => 'Standard WA target face 9 - 1', 'INNER_TEN' => 'Standard WA target face 10-1 with x-ring counting as 10, eg compound scoring', 'TRIPLE' => 'Standard 3-spot 5-zone WA target face, eg WA18m round', 'TRIPLE_INNER_TEN' => 'Standard 3-spot 5-zone WA target face with x-ring counting as 10, eg compound WA18m round', 'ONE_TO_FIVE' => '5-zone scoring, eg Worcester, NFAA Indoor', 'SIX_ZONE' => '6-zone WA target face, eg compound 50m' }
Class Method Summary collapse
-
.calculate(score, distances, rounded = true) ⇒ Object
Calculate AGB score handicap as per David Lane’s original algorithm.
Class Method Details
.calculate(score, distances, rounded = true) ⇒ Object
Calculate AGB score handicap as per David Lane’s original algorithm
Example:
>> distances = [
{'range_in_meters' => 91.44, 'total_shots' => 72, 'target_diameter_cm' => 122, 'scoring_scheme' => 'IMPERIAL'},
{'range_in_meters' => 73.152, 'total_shots' => 48, 'target_diameter_cm' => 122, 'scoring_scheme' => 'IMPERIAL'},
{'range_in_meters' => 54.864, 'total_shots' => 24, 'target_diameter_cm' => 122, 'scoring_scheme' => 'IMPERIAL'}
]
>> score = 1105
>> result = AgbHandicap.calculate(score, distances)
27 28 29 30 |
# File 'lib/agb_handicap.rb', line 27 def calculate(score, distances, rounded = true) result = agbhandicap(score, distances) rounded ? result.ceil.to_i : result end |