Skip to content

Instantly share code, notes, and snippets.

@danielzurawski
Created August 12, 2013 20:08
Show Gist options
  • Save danielzurawski/6214628 to your computer and use it in GitHub Desktop.
Save danielzurawski/6214628 to your computer and use it in GitHub Desktop.
fiz-with-book
(defn fiz-with-book
[look {[x y] :pos}]
(let [move (look [x (inc y)])
move-up [x (dec y)]
move-down [x (inc y)]
move-left [(dec x) y]
move-right [(inc x) y]]
(cond (nil? (look move-up)) {:pos move-up}
(nil? (look move-left)) {:pos move-left}
(nil? (look move-down)) {:pos move-down}
:else {:pos move-right})))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment