Skip to content

Instantly share code, notes, and snippets.

@aterreno
Created August 13, 2013 07:29
Show Gist options
  • Save aterreno/6218688 to your computer and use it in GitHub Desktop.
Save aterreno/6218688 to your computer and use it in GitHub Desktop.
(defn go-right [[x y]] {:pos [(inc x) y]})
(defn go-left [[x y]] {:pos [(dec x) y]})
(defn go-down [[x y]] {:pos [x (inc y)]})
(defn go-up [[x y]] {:pos [x (dec y)]})
;; I'm pretty (cool) and I know it!
(defn enterprise-buzz
"To infinity and beyond!"
[look {[x y] :pos}]
(println (look [ x y]))
(let [up (not (look [x (dec y)]))
down (not (look [x (inc y)]))
right (not (look [(inc x ) y]))
left (not (look [(dec x) y]))
pair [x y]]
((if right go-right
(if up go-up
(if left go-left
(if down
go-down ))))
pair)))
;; Work in progress
(defn greedy-buzz
[look {[x y] :pos}]
)
(defn path-length [look x-fn y-fn x y]
(count (take-while
(complement nil)
(map look
(iterate (fn [[ x y]])
[(x-fn x) (y-fn y)])))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment