Sha256: 60738aa284e1ab930c8e3746c781778b6d196b124374ab6d55dadddbbd1eff34
Contents?: true
Size: 542 Bytes
Versions: 1
Compression:
Stored size: 542 Bytes
Contents
module Yahtzee::Scoring module UpperCard module_function def score_aces(dice) score_sums(dice, 1) end def score_twos(dice) score_sums(dice, 2) end def score_threes(dice) score_sums(dice, 3) end def score_fours(dice) score_sums(dice, 4) end def score_fives(dice) score_sums(dice, 5) end def score_sixes(dice) score_sums(dice, 6) end def score_sums(dice, scoring_die) dice.select {|die| die == scoring_die}.reduce(:+) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
functional-yahtzee-0.0.3 | lib/scoring/upper_card.rb |