Last active
December 24, 2015 02:19
-
-
Save mzdravkov/6730316 to your computer and use it in GitHub Desktop.
An attempt (fail) to create ultra simple path finding algorithm in maze in Clojure.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; 'from' is the current point of search, 'to' is the target, level is the maze/2DMatrix | |
(defn pathar | |
([level from to] (pathar level from to [])) | |
([level from to path] | |
(if (= from to) | |
path | |
(let [nb (valid-neighbours level from)] ;valid neighbours returns the indexes of all valid (in the 2dmatrix) neighbour elements. | |
(pmap #(pathar level % to (cons from path)) nb))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment