5 kyu
Greed is Good
16,320 of 59,331JulianNicholls
Description:
Greed is a dice game played with five six-sided dice. Your mission, should you choose to accept it, is to score a throw according to these rules. You will always be given an array with five six-sided dice values.
Three 1's => 1000 points
Three 6's => 600 points
Three 5's => 500 points
Three 4's => 400 points
Three 3's => 300 points
Three 2's => 200 points
One 1 => 100 points
One 5 => 50 point
A single die can only be counted once in each roll. For example, a given "5" can only count as part of a triplet (contributing to the 500 points) or as a single 50 points, but not both in the same roll.
Example scoring
Throw Score
--------- ------------------
5 1 3 4 1 250: 50 (for the 5) + 2 * 100 (for the 1s)
1 1 1 3 1 1100: 1000 (for three 1s) + 100 (for the other 1)
2 4 4 5 4 450: 400 (for three 4s) + 50 (for the 5)
Note: your solution must not modify the input array.
Algorithms
Similar Kata:
Stats:
Created | Oct 30, 2013 |
Published | Oct 30, 2013 |
Warriors Trained | 115575 |
Total Skips | 17559 |
Total Code Submissions | 307068 |
Total Times Completed | 59331 |
JavaScript Completions | 16320 |
CoffeeScript Completions | 154 |
Ruby Completions | 2209 |
C# Completions | 4882 |
Python Completions | 21068 |
Java Completions | 7326 |
C++ Completions | 4690 |
C Completions | 2036 |
F# Completions | 94 |
Clojure Completions | 130 |
COBOL Completions | 15 |
Scala Completions | 134 |
Rust Completions | 194 |
Swift Completions | 97 |
Kotlin Completions | 135 |
TypeScript Completions | 403 |
Go Completions | 272 |
PHP Completions | 214 |
Haskell Completions | 26 |
Lua Completions | 12 |
Total Stars | 1826 |
% of votes with a positive feedback rating | 89% of 4699 |
Total "Very Satisfied" Votes | 3773 |
Total "Somewhat Satisfied" Votes | 817 |
Total "Not Satisfied" Votes | 109 |