comparison org/vision.org @ 189:facc2ef3fe5c

added hearing debug view.
author Robert McIntyre <rlm@mit.edu>
date Sat, 04 Feb 2012 10:13:15 -0700
parents 22548d48cc85
children ac158a976443
comparison
equal deleted inserted replaced
188:22548d48cc85 189:facc2ef3fe5c
235 (reduce 235 (reduce
236 concat 236 concat
237 (for [eye (eyes creature)] 237 (for [eye (eyes creature)]
238 (vision-fn creature eye)))) 238 (vision-fn creature eye))))
239 239
240 (defvar 240 (defn view-vision
241 view-vision 241 "Creates a function which accepts a list of visual sensor-data and
242 displays each element of the list to the screen."
243 []
242 (view-sense 244 (view-sense
243 (fn 245 (fn
244 [[coords sensor-data]] 246 [[coords sensor-data]]
245 (let [image (points->image coords)] 247 (let [image (points->image coords)]
246 (dorun 248 (dorun
247 (for [i (range (count coords))] 249 (for [i (range (count coords))]
248 (.setRGB image ((coords i) 0) ((coords i) 1) 250 (.setRGB image ((coords i) 0) ((coords i) 1)
249 (sensor-data i)))) 251 (sensor-data i))))
250 image))) 252 image))))
251 "Creates a function which accepts visual sensor-data and displays it
252 to the screen.")
253 253
254 #+end_src 254 #+end_src
255 255
256 256
257 Note the use of continuation passing style for connecting the eye to a 257 Note the use of continuation passing style for connecting the eye to a