Last active
December 20, 2015 04:09
-
-
Save dongweiming/6068549 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun score (dice) | |
(reduce #'+ (mapcar #'(lambda (n) | |
(let ((coun (count n dice))) | |
(case n | |
(1 (cond ((= coun 3) 1000) | |
((< coun 3) (* 100 coun)) | |
((> coun 3) (+ 1000 (* 100 (- coun 3)))))) | |
(5 (cond ((= coun 3) 500) | |
((< coun 3) (* coun 50)) | |
((> coun 3) (+ 500 (* (- coun 3) 50))))) | |
(otherwise | |
(if (>= coun 3) | |
(* n 100) | |
0))))) | |
(remove-duplicates dice)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment