Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Minor refactorings suggested by Gery Debongnie.

  • Loading branch information...
commit b7278efac520762cae227d8c9858ae3b3532d43c 1 parent 4a52a0d
Steve Losh authored
15 src/caves/core.clj
View
@@ -23,12 +23,15 @@
(defn run-game [game screen]
(loop [{:keys [input uis] :as game} game]
(when (seq uis)
- (if (nil? input)
- (let [game (update-in game [:world] tick-all)
- _ (draw-game game screen)
- game (clear-messages game)]
- (recur (get-input game screen)))
- (recur (process-input (dissoc game :input) input))))))
+ (recur (if input
+ (-> game
+ (dissoc :input)
+ (process-input input))
+ (-> game
+ (update-in [:world] tick-all)
+ (draw-game screen)
+ (clear-messages)
+ (get-input screen)))))))
(defn new-game []
(->Game nil [(->UI :start)] nil {:show-regions false}))
3  src/caves/ui/drawing.clj
View
@@ -153,4 +153,5 @@
(s/clear screen)
(doseq [ui (:uis game)]
(draw-ui ui game screen))
- (s/redraw screen))
+ (s/redraw screen)
+ game)
2  src/caves/utils.clj
View
@@ -28,4 +28,4 @@
(defn enumerate [s]
- (map vector (iterate inc 0) s))
+ (map-indexed vector s))
Please sign in to comment.
Something went wrong with that request. Please try again.