Skip to content

Instantly share code, notes, and snippets.

@bjhaid
Created March 15, 2014 02:37
Show Gist options
  • Save bjhaid/9561102 to your computer and use it in GitHub Desktop.
Save bjhaid/9561102 to your computer and use it in GitHub Desktop.
tic_tac solve in clojure
(fn [tic_tac]
(first (first (filter #(and (apply = %) (not (.contains % :e)))
((fn [tic_tac] (conj (apply conj tic_tac
((fn [tic_tac] (vec (map (fn[x] (vec (map #((tic_tac %) x) (range 3)))) (range 3)))) tic_tac))
((fn [tic_tac] (vec (map #((tic_tac %) %) (range 3)))) tic_tac)
((fn [tic_tac] (vec (map #((tic_tac (- 2 %)) %) (range 3)))) tic_tac))) tic_tac))))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment