Created
August 12, 2013 20:08
-
-
Save danielzurawski/6214628 to your computer and use it in GitHub Desktop.
fiz-with-book
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
(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