fixed bug in robot.clj, all previous tests now working

This commit is contained in:
Richard Harrington 2013-08-06 19:21:35 -04:00
parent f1b94518f7
commit b43eb26b37

View File

@ -150,10 +150,10 @@
(if (>= (:damage robot) 100) (if (>= (:damage robot) 100)
world world
(let [new-world (brain/step-brain robot world) (let [new-world (brain/step-brain robot world)
new-robot (get-in world [new-world :robots robot-idx]) new-robot (get-in new-world [:robots robot-idx])
desired-v-x (do (pprint new-robot) (brain/read-register desired-v-x (brain/read-register
(get-in new-robot [:registers "SPEEDX"]) (get-in new-robot [:registers "SPEEDX"])
new-world)) new-world)
desired-v-y (brain/read-register desired-v-y (brain/read-register
(get-in new-robot [:registers "SPEEDY"]) (get-in new-robot [:registers "SPEEDY"])
new-world) new-world)
@ -164,8 +164,8 @@
(assoc-in (assoc-in
new-world new-world
[:robots robot-idx] [:robots robot-idx]
(into robot {:pos-x pos-x (into new-robot {:pos-x pos-x
:pos-y pos-y :pos-y pos-y
:v-x v-x :v-x v-x
:v-y v-y}))))) :v-y v-y})))))