     [_ _ _ 6 2 _ _ _ _]
     [_ _ _ 1 _ _ _ _ _]])
 
-;(def hard
-;  '[[1 _ _ _ _ _ _ 1 2]
-;    [_ _ 8 _ 3 _ _ _ _]
-;    [_ _ _ _ _ _ _ 4 _]
-;    [1 2 _ 5 _ _ _ _ _]
-;    [_ _ _ _ _ 4 7 _ _]
-;    [_ 6 _ _ _ _ _ _ _]
-;    [5 _ 7 _ _ 9 3 _ _]
-;    [_ _ _ 6 2 _ _ _ _]
-;    [_ _ _ 1 _ _ _ _ _]])
+(defn solve [board]
+  (loop [[f & r] [(initialize board)]]
+    (cond
+      (every? #(every? integer? %) f) f
+      (nil? f) f
+      :default (recur (into r (solve-step f))))))
 
-(let [[[board unsolved-cells :as f] & r] [[hard (unknowns hard)]]]
-  (first (some (constraints f) (range)))
-  #_(if-not (empty? unsolved-cells)
-      (into r (lock-cells f (first (some (constraints f) (range)))))
-      board))
-
-(time (solve hard))
+;(solve hard)
 
 ;;;;;;;;;;;;;;;
 (defn valid-cell? [board cell]

(ns clojure-club.sudoku.mbastian)

;Copied from https://github.com/markbastian/sudoku/blob/master/src/cljc/sudoku/rules.cljc
(def valid-values (apply hash-set (range 1 10)))

(defonce all-cells (for [i (range 9) j (range 9)] [i j]))

(defn valid-board? [board]
  (and
    (every? (partial get-in board) all-cells)
    (empty? (bad-cells board))))
