repl jack-in.

This commit is contained in:
=
2014-09-11 13:03:26 -07:00
parent dc40512eda
commit 8ebd46a935
3 changed files with 25 additions and 13 deletions

View File

@@ -31,16 +31,16 @@
(defn resolve-path [came-from play-loc target-loc]
(doto (if (nil? (came-from target-loc))
nil
(loop [path []
current-node target-loc]
(if (or (= current-node play-loc)
(nil? current-node))
(reverse (map (fn [[x y]] [x y]) (conj path current-node)))
(recur
(conj path current-node)
(came-from current-node))))) println))
(if (nil? (came-from target-loc))
nil
(loop [path []
current-node target-loc]
(if (or (= current-node play-loc)
(nil? current-node))
(reverse (map (fn [[x y]] [x y]) (conj path current-node)))
(recur
(conj path current-node)
(came-from current-node))))))
(defn heuristic [[goal-x goal-y] [current-x current-y]]
(let [dist-x (Math/abs (- goal-x current-x ))