mirror of
https://github.com/richardharrington/robotwar.git
synced 2024-05-28 23:41:31 +00:00
refactored 'register' with path-to-robot-field convenience function
This commit is contained in:
parent
70c866189b
commit
07596d8fad
|
@ -8,6 +8,9 @@
|
|||
(defn path-to-robot [robot-idx]
|
||||
[:robots robot-idx])
|
||||
|
||||
(defn path-to-robot-field [robot-idx robot-field]
|
||||
[:robots robot-idx robot-field])
|
||||
|
||||
(defn path-to-registers [robot-idx]
|
||||
[:robots robot-idx :brain :registers])
|
||||
|
||||
|
@ -41,7 +44,7 @@
|
|||
(fn [this world]
|
||||
(Math/round (/ (get-in
|
||||
world
|
||||
(conj (path-to-robot (:robot-idx this)) (:field-name this)))
|
||||
(path-to-robot-field (:robot-idx this) (:field-name this)))
|
||||
(:multiplier this))))})
|
||||
|
||||
(def robot-field-write-mixin
|
||||
|
@ -51,7 +54,7 @@
|
|||
(fn [this world data]
|
||||
(assoc-in
|
||||
world
|
||||
(conj (path-to-robot (:robot-idx this)) (:field-name this))
|
||||
(path-to-robot-field (:robot-idx this) (:field-name this))
|
||||
(float (* data (:multiplier this)))))})
|
||||
|
||||
(def no-op-write-mixin
|
||||
|
|
Loading…
Reference in New Issue
Block a user