Created
July 10, 2014 14:34
-
-
Save rockBreaker/8f58effcae101d252d85 to your computer and use it in GitHub Desktop.
horrible clojure code to sort a poker hand and check for a straight
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
;sorted hand vals | |
(defn sorted-hand-vals [hand] | |
(sort (keys (frequencies (map rank hand))))) | |
(defn low-ace-helper [hand] | |
(= hand (range (apply min hand) (inc (apply max hand))))) | |
;low ace straight? | |
(defn low-ace-straight? [hand] | |
(low-ace-helper (sort (replace {14 1} (sorted-hand-vals hand))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment