Sha256: 4d2c4b5636da18cdf87f0f592cbfcc6378269b41d0f40c889d9a9bac542db583

Contents?: true

Size: 1.79 KB

Versions: 41

Compression:

Stored size: 1.79 KB

Contents

# Score a single throw of dice in *Yacht*

The dice game [Yacht](https://en.wikipedia.org/wiki/Yacht_(dice_game)) is from
the same family as Poker Dice, Generala and particularly Yahtzee, of which it
is a precursor. In the game, five dice are rolled and the result can be entered
in any of twelve categories. The score of a throw of the dice depends on
category chosen.

## Scores in Yacht

    Category    Score                   Example
    Ones            1 × number of ones      1 1 1 4 5 scores 3
    Twos            2 × number of twos      2 2 3 4 5 scores 4
    Threes          3 × number of threes    3 3 3 3 3 scores 15
    Fours           4 × number of fours     1 2 3 3 5 scores 0
    Fives           5 × number of fives     5 1 5 2 5 scores 15
    Sixes           6 × number of sixes     2 3 4 5 6 scores 6
    Full House      Total of the dice       3 3 3 5 5 scores 19
    Four of a Kind  Total of the four dice  4 4 4 4 6 scores 16
    Little Straight 30 points               1 2 3 4 5 scores 30
    Big Straight    30 points               2 3 4 5 6 scores 30
    Choice          Sum of the dice         2 3 3 4 6 scores 18
    Yacht           50 points               4 4 4 4 4 scores 50

If the dice do not satisfy the requirements of a category, the score is zero.
If, for example, *Four Of A Kind* is entered in the *Yacht* category, zero
points are scored. A *Yacht* scores zero if entered in the *Full House* category.

## Task
Given a list of values for five dice and a category, your solution should return
the score of the dice for that category. If the dice do not satisfy the requirements
of the category your solution should return 0. You can assume that five values
will always be presented, and the value of each will be between one and six
inclusively. You should not assume that the dice are ordered.

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
trackler-2.2.1.179 problem-specifications/exercises/yacht/description.md
trackler-2.2.1.178 problem-specifications/exercises/yacht/description.md
trackler-2.2.1.177 problem-specifications/exercises/yacht/description.md
trackler-2.2.1.176 problem-specifications/exercises/yacht/description.md
trackler-2.2.1.175 problem-specifications/exercises/yacht/description.md
trackler-2.2.1.174 problem-specifications/exercises/yacht/description.md
trackler-2.2.1.173 problem-specifications/exercises/yacht/description.md
trackler-2.2.1.172 problem-specifications/exercises/yacht/description.md
trackler-2.2.1.171 problem-specifications/exercises/yacht/description.md
trackler-2.2.1.170 problem-specifications/exercises/yacht/description.md
trackler-2.2.1.169 problem-specifications/exercises/yacht/description.md
trackler-2.2.1.167 problem-specifications/exercises/yacht/description.md
trackler-2.2.1.166 problem-specifications/exercises/yacht/description.md
trackler-2.2.1.165 problem-specifications/exercises/yacht/description.md
trackler-2.2.1.164 problem-specifications/exercises/yacht/description.md
trackler-2.2.1.163 problem-specifications/exercises/yacht/description.md
trackler-2.2.1.162 problem-specifications/exercises/yacht/description.md
trackler-2.2.1.161 problem-specifications/exercises/yacht/description.md
trackler-2.2.1.160 problem-specifications/exercises/yacht/description.md
trackler-2.2.1.159 problem-specifications/exercises/yacht/description.md