Created
October 26, 2018 05:29
-
-
Save melbourne2991/728403e8b831c6febc46c619958e26c9 to your computer and use it in GitHub Desktop.
Clojure stuff
This file contains hidden or 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
(def grid (atom [ | |
[0 0 0] | |
[0 0 0] | |
[0 0 0] | |
])) | |
(defn update-grid [row-index col-index val] | |
(swap! grid assoc-in [row-index col-index] val)) | |
(defn full-row? [row] | |
(every? pos? row)) | |
(defn winner? [] | |
(or ( | |
(some full-row? (get-cols)) | |
(some full-row? @grid)))) | |
(defn get-cols [] (vec (apply map vector @grid))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment