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

Stats:

CreatedOct 30, 2013
PublishedOct 30, 2013
Warriors Trained115575
Total Skips17559
Total Code Submissions307068
Total Times Completed59331
JavaScript Completions16320
CoffeeScript Completions154
Ruby Completions2209
C# Completions4882
Python Completions21068
Java Completions7326
C++ Completions4690
C Completions2036
F# Completions94
Clojure Completions130
COBOL Completions15
Scala Completions134
Rust Completions194
Swift Completions97
Kotlin Completions135
TypeScript Completions403
Go Completions272
PHP Completions214
Haskell Completions26
Lua Completions12
Total Stars1826
% of votes with a positive feedback rating89% of 4699
Total "Very Satisfied" Votes3773
Total "Somewhat Satisfied" Votes817
Total "Not Satisfied" Votes109
Ad
Contributors
  • JulianNicholls Avatar
  • jhoffner Avatar
  • guumaster Avatar
  • TehCupcakes Avatar
  • JDeBolt Avatar
  • lechevalier Avatar
  • BrendanVadacoraBell Avatar
  • Blind4Basics Avatar
  • purrucker Avatar
  • neilm Avatar
  • rowcased Avatar
  • rsa Avatar
  • Awesome A.D. Avatar
  • sazzadshopno Avatar
  • hobovsky Avatar
  • cliffstamp Avatar
  • ehonsey Avatar
  • akar-0 Avatar
  • tobeannouncd Avatar
  • KayleighWasTaken Avatar
  • metatable Avatar
  • pearcebasmanm Avatar
  • fojas Avatar
Ad