       (if (last-on-row? board goal)
         (let [row-min (coords->tile board [0 y])]
           (move-sequence board
-                         [tile [x (+ y 1)] solved]
+                         [tile [x (inc y)] solved]
                          [0 [0 y] (conj (disj solved row-min) tile)]
                          [0 [x y] #{}]
                          [tile [x y] solved]
-                         [0 [(- x 1) y] #{tile}]
+                         [0 [(dec x) y] #{tile}]
                          [row-min [0 y] #{tile}]
                          ))
         (move-to board tile goal solved)))))

  (= (count board) (count (solved-tiles board))))

(defn goal-coord [board tile]
  (index->coords board (- (if (= tile 0)
                            (count board)
                            tile) 1)))

(defn last-on-row? [board [x y]]
  (= x (- (dimension board) 1)))

(defn move-sequence [board [tile goal solved] & more]
  (let [path (move-to board tile goal solved)]

      (recur (apply assoc dmap costs)
             next
             (set/union seen coords)
             (inc cost)))))

(defn distance-map [board goal avoid]
  (dijkstra-map (vec (repeat (count board) (count board)))
