mirror of
https://github.com/richardharrington/robotwar.git
synced 2024-06-04 07:29:33 +00:00
added support for shells to tick-combined-world
This commit is contained in:
parent
12e80d2379
commit
5a5fb86359
|
@ -21,9 +21,16 @@
|
|||
|
||||
(defn tick-combined-world
|
||||
[starting-world]
|
||||
(reduce (fn [{robots :robots :as world} robot-idx]
|
||||
(robot/tick-robot (robots robot-idx) world))
|
||||
starting-world
|
||||
(range (count (:robots starting-world)))))
|
||||
(let [{shells :shells :as ticked-robots-world} (reduce (fn [{robots :robots :as world} robot-idx]
|
||||
(robot/tick-robot (robots robot-idx) world))
|
||||
starting-world
|
||||
(range (count (:robots starting-world))))
|
||||
ticked-shells (map shell/tick-shell shells)
|
||||
live-shells (remove :exploded ticked-shells)
|
||||
exploded-shells (filter :exploded ticked-shells)]
|
||||
; TODO: make this a real let-binding, that determines
|
||||
; which robots were damaged.
|
||||
(let [damaged-world ticked-robots-world]
|
||||
(assoc damaged-world :shells live-shells))))
|
||||
|
||||
(def build-combined-worlds (partial iterate tick-combined-world))
|
||||
|
|
Loading…
Reference in New Issue
Block a user