Created
February 14, 2011 13:04
-
-
Save neilmock/825842 to your computer and use it in GitHub Desktop.
roulette!
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
(ns roulette.core) | |
(defn spin [] | |
(int (rand 38))) | |
(def *bankroll* (atom 1000)) | |
(defn dobet | |
[bets] | |
(let [winner (spin)] | |
(doseq [[num bet] bets] | |
(if (= num winner) | |
(swap! *bankroll* + (* 36 bet)) | |
(swap! *bankroll* - bet))) | |
winner)) | |
;; (for [i (range 50)] (dobet {21 25 4 5 7 5 11 5 35 5 5 100})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment