-
-
Save amalloy/ea397d8052c71fefbb4b to your computer and use it in GitHub Desktop.
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 simple-bot [] | |
(let [state *game-state*] | |
(reduce (fn [state ant] | |
(binding [*game-state* state] | |
(when-let [dir (rand-nth (filter #(unoccupied? | |
(can-move? ant %)) | |
directions))] | |
(let [new-pos (move-ant ant dir)] | |
(move ant dir) ; send actual command | |
(update-in state [:ants] #(-> % ; update state | |
(disj ant) | |
(conj new-pos))))))) | |
state | |
(my-ants)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment