Skip to content

Instantly share code, notes, and snippets.

@bas080
Created December 18, 2015 12:27
Show Gist options
  • Save bas080/7307003a6247ae9c6352 to your computer and use it in GitHub Desktop.
Save bas080/7307003a6247ae9c6352 to your computer and use it in GitHub Desktop.
(defn throw-die [] (inc (rand-int 6)))
(defn throw-dice [] (repeatedly throw-die))
(defn yahtzee? [numbers] (apply = numbers))
(defn printlnrt [v] (do (println v) v))
(defn throw-yahtzee [] (while (not (yahtzee? (printlnrt (take 14 (throw-dice)))))))
(throw-yahtzee)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment