Permalink
Browse files

Improve code.

  • Loading branch information...
1 parent 7ae2845 commit 7a90a7a906752582eb75f64b26f23a5ce5a0fc82 @nbeloglazov committed Nov 9, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/snakejure/core.clj
View
@@ -45,8 +45,9 @@
(into apples)))
apples)))
-(defn update-world [{:keys [snakes apples walls]}]
- (let [new-snakes (map #(move-snake % apples) snakes)
+(defn update-world [world]
+ (let [{:keys [snakes apples walls]} world
+ new-snakes (map #(move-snake % apples) snakes)
occupied (frequencies (concat walls
(mapcat :body new-snakes)))
dead? (fn [snake] (> (occupied (first (:body snake))) 1))

0 comments on commit 7a90a7a

Please sign in to comment.