Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
12
Task/Nim-game/Clojure/nim-game.clj
Normal file
12
Task/Nim-game/Clojure/nim-game.clj
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
(loop [n 12]
|
||||
(print (format "%s remain, take how many?\n> " n)) (flush)
|
||||
(let [v (try (Long. (clojure.string/trim (read-line)))
|
||||
(catch Exception _ 0))]
|
||||
(if (#{1 2 3} v)
|
||||
(do (println (format "You took %s, leaving %s, computer takes %s..."
|
||||
v (- n v) (- 4 v)))
|
||||
(if (= 4 n)
|
||||
(println "Computer wins. 😐")
|
||||
(recur (- n 4))))
|
||||
(do (println "Please enter 1, 2, or 3...")
|
||||
(recur n)))))
|
||||
Loading…
Add table
Add a link
Reference in a new issue