Definitions for world-1
;; Light is a type of electromagnetic radiation, visible-light
;; and infrared are types of light, low- and high-infrared are
;; types of infrared radiation.
(define-radiation-types
(light (electromagnetic))
(visible-light (light))
(infrared (light))
(low-infrared (infrared))
(high-infrared (infrared)))
;; Define two yellow lamps, each radiating visible light.
(define-lamp lamp-1
(:position 0.0 0.0)
(:color 1.0 1.0 0.0)
(:radiator r1
(:radiation-type visible-light)
(:decay-factor 0.05)))
(define-lamp lamp-2
(:position -4.0 -4.0)
(:color 1.0 1.0 0.0)
(:radiator r1
(:radiation-type visible-light)
(:decay-factor 0.05)))
;; The green vehicle.
;; Homes in on visible light, motors radiate in low infrared.
(define-vehicle simple-light-seeker
(:position 5.0 5.0)
(:orientation 0)
(:max-speed 15)
(:color 0 1.0 0)
(:sensor s1
(:orientation -30)
(:radiation-type visible-light)
(:sensitivity 3.0))
(:sensor s2
(:orientation 30)
(:radiation-type visible-light)
(:sensitivity 3.0))
(:motor m1
(:position right)
(:decay-factor 0.2))
(:motor m2
(:position left)
(:decay-factor 0.2))
(:radiator r1
(:radiation-type low-infrared)
(:decay-factor 1.0))
(:brain
(r1 (:inputs (m1 m2)))
(m1 (:inputs (s2)))
(m2 (:inputs (s1)))))
;; The red vehicle.
;; Sensors are sensitive to low infrared, motors radiate
;; high infrared (you might say its apparent self-awareness
;; is due to its unawareness).
(define-vehicle heat-seeker
(:position -7.0 6.0)
(:orientation 0.0)
(:max-speed 15.0)
(:color 1.0 0 0)
(:sensor s1
(:orientation -40)
(:radiation-type low-infrared)
(:sensitivity 10.0))
(:sensor s2
(:orientation 40)
(:radiation-type low-infrared)
(:sensitivity 10.0))
(:motor m1
(:position right)
(:decay-factor 0.2))
(:motor m2
(:position left)
(:decay-factor 0.2))
(:radiator r1
(:radiation-type high-infrared)
(:decay-factor 1))
(:brain
(m2 (:inputs (s1)))
(m1 (:inputs (s2)))
(r1 (:inputs (m1 m2)))))
;; The blue vehicle.
;; Sensors pick up the high infrared radiation generated by
;; the predator's motors. Motors radiate in low infrared.
(define-vehicle non-linear-shy-seeker
(:position -2.0 4.0)
(:orientation 294)
(:color 0 0 1.0)
;; sensors
(:sensor s1
(:orientation 30)
(:radiation-type visible-light)
(:sensitivity 4.0))
(:sensor s2
(:orientation -30)
(:radiation-type visible-light)
(:sensitivity 4.0))
(:sensor s3
(:orientation 50)
(:radiation-type high-infrared)
(:sensitivity 2.0))
(:sensor s4
(:orientation -50)
(:radiation-type high-infrared)
(:sensitivity 2.0))
;; motors
(:motor m1
(:position left)
(:decay-factor 0.1))
(:motor m2
(:position right)
(:decay-factor 0.1))
(:radiator r1
(:radiation-type low-infrared)
(:decay-factor 1.0))
(:brain
;; Light-seeking behavior
(n1 (:inputs (s1))
(:inhibitors (n3))
(:threshold 1))
(n2 (:inputs (s1))
(:threshold 1))
(n3 (:inputs (n2))
(:threshold 1))
;; Predator avoidance behavior
(n4 (:inputs (s2))
(:threshold 1))
(n5 (:inputs (s2))
(:threshold 1))
(n6 (:inputs (n5))
(:inhibitors (n4))
(:threshold 1))
;; Connect neurodes as input to motors.
(m1 (:inputs (n6 s3)))
(m2 (:inputs (n1 s4)))
;; Connect motors as input to heat generator.
(r1 (:inputs (m1 m2)))))