comparison org/vision.org @ 188:22548d48cc85

added debug for vision
author Robert McIntyre <rlm@mit.edu>
date Sat, 04 Feb 2012 10:00:37 -0700
parents 04a39e6bb695
children facc2ef3fe5c
comparison
equal deleted inserted replaced
187:6142e85f5825 188:22548d48cc85
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
241 view-vision
242 (view-sense
243 (fn
244 [[coords sensor-data]]
245 (let [image (points->image coords)]
246 (dorun
247 (for [i (range (count coords))]
248 (.setRGB image ((coords i) 0) ((coords i) 1)
249 (sensor-data i))))
250 image)))
251 "Creates a function which accepts visual sensor-data and displays it
252 to the screen.")
253
240 #+end_src 254 #+end_src
241 255
242 256
243 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
244 function to process the output. You can create any number of eyes, and 258 function to process the output. You can create any number of eyes, and