repl jack-in.
This commit is contained in:
@@ -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 ))
|
||||
|
||||
Reference in New Issue
Block a user