diff thesis/garbage_cortex.org @ 523:90b236381642

s.
author Robert McIntyre <rlm@mit.edu>
date Thu, 03 Apr 2014 20:48:09 -0400
parents 1e5ea711857d
children
line wrap: on
line diff
     1.1 --- a/thesis/garbage_cortex.org	Mon Mar 31 09:21:28 2014 -0400
     1.2 +++ b/thesis/garbage_cortex.org	Thu Apr 03 20:48:09 2014 -0400
     1.3 @@ -97,4 +97,46 @@
     1.4  
     1.5  \cite{Tappert77}
     1.6  lol
     1.7 -\cite{Tappert77}
     1.8 \ No newline at end of file
     1.9 +\cite{Tappert77}
    1.10 +
    1.11 +
    1.12 +
    1.13 +
    1.14 +   #+caption: This sensory predicate detects when the worm is resting on the 
    1.15 +   #+caption: ground using the worm's sense of touch.
    1.16 +   #+name: resting-intro
    1.17 +   #+begin_listing clojure
    1.18 +   #+begin_src clojure
    1.19 +(defn resting?
    1.20 +  "Is the worm resting on the ground?"
    1.21 +  [experiences]
    1.22 +  (every?
    1.23 +   (fn [touch-data]
    1.24 +     (< 0.9 (contact worm-segment-bottom touch-data)))
    1.25 +   (:touch (peek experiences))))
    1.26 +   #+end_src
    1.27 +   #+end_listing
    1.28 +
    1.29 +   #+caption: Even complicated actions such as ``wiggling'' are fairly simple
    1.30 +   #+caption: to describe with a rich enough language.
    1.31 +   #+name: wiggling-intro
    1.32 +   #+begin_listing clojure
    1.33 +   #+begin_src clojure
    1.34 +(defn wiggling?
    1.35 +  "Is the worm wiggling?"
    1.36 +  [experiences]
    1.37 +  (let [analysis-interval 0x40]
    1.38 +    (when (> (count experiences) analysis-interval)
    1.39 +      (let [a-flex 3
    1.40 +            a-ex   2
    1.41 +            muscle-activity
    1.42 +            (map :muscle (vector:last-n experiences analysis-interval))
    1.43 +            base-activity
    1.44 +            (map #(- (% a-flex) (% a-ex)) muscle-activity)]
    1.45 +        (= 2
    1.46 +           (first
    1.47 +            (max-indexed
    1.48 +             (map #(Math/abs %)
    1.49 +                  (take 20 (fft base-activity))))))))))
    1.50 +   #+end_src
    1.51 +   #+end_listing