Mercurial > cortex
comparison org/vision.org @ 321:702b5c78c2de
gathered all the tests into (run-suite), which should make testing vastly easier.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 08 May 2012 08:22:19 -0500 |
parents | bb3f8a4af87f |
children | 5dcd44576cbc |
comparison
equal
deleted
inserted
replaced
320:52de8a36edde | 321:702b5c78c2de |
---|---|
535 #+name: test-2 | 535 #+name: test-2 |
536 #+begin_src clojure | 536 #+begin_src clojure |
537 (in-ns 'cortex.test.vision) | 537 (in-ns 'cortex.test.vision) |
538 | 538 |
539 (defn change-color [obj color] | 539 (defn change-color [obj color] |
540 (println-repl obj) | 540 ;;(println-repl obj) |
541 (if obj | 541 (if obj |
542 (.setColor (.getMaterial obj) "Color" color))) | 542 (.setColor (.getMaterial obj) "Color" color))) |
543 | 543 |
544 (defn colored-cannon-ball [color] | 544 (defn colored-cannon-ball [color] |
545 (comp #(change-color % color) | 545 (comp #(change-color % color) |
546 (fire-cannon-ball))) | 546 (fire-cannon-ball))) |
547 | 547 |
548 (defn test-worm-vision | 548 (defn test-worm-vision |
549 "Testing vision: | |
550 You should see the worm suspended in mid-air, looking down at a | |
551 table. There are four small displays, one each for red, green blue, | |
552 and gray channels. You can fire balls of various colors, and the | |
553 four channels should react accordingly. | |
554 | |
555 Keys: | |
556 r : fire red-ball | |
557 b : fire blue-ball | |
558 g : fire green-ball | |
559 <space> : fire white ball" | |
560 | |
549 ([] (test-worm-vision false)) | 561 ([] (test-worm-vision false)) |
550 ([record?] | 562 ([record?] |
551 (let [the-worm (doto (worm)(body!)) | 563 (let [the-worm (doto (worm)(body!)) |
552 vision (vision! the-worm) | 564 vision (vision! the-worm) |
553 vision-display (view-vision) | 565 vision-display (view-vision) |