Skip to main content
2 of 3
Saved some bytes by using Boolean logic for addition rather than pseudo-ternaries
AdmBorkBork
  • 43.5k
  • 5
  • 103
  • 284

PowerShell v2+ v3+, 147 144 137 bytes

$n=$args[0]|sort;while($n){if(($x=$n[0])-eq$n[2]){$s+=100*$x+900*($x-eq1);$a,$b,$c,$n=$n}else{$s+=50*($x-in1,5)+50*($x-eq1);$a,$n=$n}};$s

Crossed out 144 looks kinda like 144?

Takes input $args[0] and sorts it, stores it into $n. Then, while there are still elements left, we evaluate an if/else.

If the first element (temp stored into $x to save some bytes) matches the third element, we have a triple. Add onto the $sum the result of some multiplication 100*$x plus a Boolean-based 900 only if $x is -equal to 1. This gets us the requisite 1000 for three ones. Then, peel off the first three elements into $a, $b, $c and the remaining into $n.

Otherwise, we don't have a triple, so add on to $sum the result of another Boolean-based addition. We add 50 if $x is either 1 or 5, then add on another 50 if it's -equal to 1. This section now requires v3+ for the -in operator. Then, peel off the first element and leave the remaining in $n.

Finally, once the loop is done, place $s on the pipeline. Output is an implicit Write-Output at the end of execution.

Test cases

PS C:\Tools\Scripts\golfing> (1,2,3,4,5,6),(1,1,1,2,3,5),(1,1,1,1,1,1),(2,2,2,2,2,2),(6,6,1,5,5,6),(2,3,4,6,2,4),(1,5,1,5,1,5),(5,5,5,5,2,3),(1,1,1,1,1,5),(3,3,4,4,3,4)|%{($_-join',')+" -> "+(.\evaluate-dice-1000.ps1 $_)}
1,2,3,4,5,6 -> 150
1,1,1,2,3,5 -> 1050
1,1,1,1,1,1 -> 2000
2,2,2,2,2,2 -> 400
6,6,1,5,5,6 -> 800
2,3,4,6,2,4 -> 0
1,5,1,5,1,5 -> 1500
5,5,5,5,2,3 -> 550
1,1,1,1,1,5 -> 1250
3,3,4,4,3,4 -> 700
AdmBorkBork
  • 43.5k
  • 5
  • 103
  • 284