anchor.diff:     (max-speed
       :initarg :max-speed
       :accessor max-speed
  -    :initform 1.0)
  +    :initform 50)
      (name
       :initform 'mover)
      (status
       :initform 'meandering)))
   
   (defclass sheep (mover)
  -  ((herd
  -    :initarg :herd
  -    :accessor herd
  -    :initform (error "Must supply a herd"))
  -   (name
  +  ((name
       :initform 'sheep)
      (status
       :initarg :status
       :accessor status
       :initform 'unknown)))
   
  -(defgeneric update (actor))
  -(defgeneric draw (actor cr))
  -(defgeneric draw-label (actor cr))
  -
  -(defmethod update (mover)
  +(defmethod herd ((sheep sheep))
  +  (actors (environment sheep)))
  +
  +(defmethod update ((mover mover))
     (when (< (random 1.0) (motivation mover))
       (let ((heading (funcall (direction-fn mover)))
             (speed (max-speed mover)))
         (setf (heading mover) heading)
  -      (incf (x mover) (* speed (cos heading)))
  -      (incf (y mover) (* speed (sin heading))))))
  -
  -(defmethod update ((mover sheep))
  -  (let* ((others (remove-if (lambda (x) (eq x mover)) (herd mover)))
  -         (nearest (car (sort others #'< :key (lambda (x) (distance x mover)))))
  -         (dist (distance nearest mover))
  +      (incf (x mover) (* speed (time-step (environment mover)) (cos heading)))
  +      (incf (y mover) (* speed (time-step (environment mover)) (sin heading))))))
  +
  +(defmethod update ((sheep sheep))
  +  (let* ((others (remove-if (lambda (x) (eq x sheep)) (herd sheep)))
  +         (nearest (car (sort others #'< :key (lambda (x) (distance x sheep)))))
  +         (dist (distance nearest sheep))
            (new-status (cond
                              ((> dist 200) 'isolated)
                              ((> dist 60) 'lonely)
                              ((< dist 20) 'crowded)
                              (t 'content))))
  -    (unless (eq new-status (status mover))
  -      (setf (status mover) new-status)
  +    (unless (eq new-status (status sheep))
  +      (setf (status sheep) new-status)
         (cond
  -        ((eq (status mover) 'isolated)
  -         (progn
  -           (setf (motivation mover) .2)
  -           (setf (direction-fn mover) (make-meander (heading mover)))
  +        ((eq (status sheep) 'isolated)
  +         (progn
  +           (setf (motivation sheep) .2)
  +           (setf (direction-fn sheep) (make-meander (heading sheep)))
              ))
  -        ((eq (status mover) 'lonely)
  -         (progn
  -           (setf (motivation mover) .4)
  -           (setf (direction-fn mover) (make-seek mover nearest))
  +        ((eq (status sheep) 'lonely)
  +         (progn
  +           (setf (motivation sheep) .4)
  +           (setf (direction-fn sheep) (make-seek sheep nearest))
              ))
  -        ((eq (status mover) 'crowded)
  -         (progn
  -           (setf (motivation mover) .5)
  -           (setf (direction-fn mover) (make-avoid mover nearest))
  +        ((eq (status sheep) 'crowded)
  +         (progn
  +           (setf (motivation sheep) .5)
  +           (setf (direction-fn sheep) (make-avoid sheep nearest))
              ))
  -        ((eq (status mover) 'content)
  -         (progn
  -           (setf (motivation mover) .1)
  -           (setf (direction-fn mover) (make-meander (heading mover)))
  +        ((eq (status sheep) 'content)
  +         (progn
  +           (setf (motivation sheep) .1)
  +           (setf (direction-fn sheep) (make-meander (heading sheep)))
              ))))    
  -    (setf (motivation mover) (cond 
  -                               ((eq (status mover) 'isolated) .2)
  -                               ((eq (status mover) 'lonely) .4)
  -                               ((eq (status mover) 'crowded) .3)
  -                               ((eq (status mover) 'content) .1))))
  +    (setf (motivation sheep) (cond 
  +                               ((eq (status sheep) 'isolated) .2)
  +                               ((eq (status sheep) 'lonely) .4)
  +                               ((eq (status sheep) 'crowded) .3)
  +                               ((eq (status sheep) 'content) .1))))
     (call-next-method))
  +
  +(defmethod draw :around (object cr)
  +  (when cr (call-next-method)))
   
   (defmethod draw (actor cr)
     (cairo-set-source-rgb cr 0.8 0.4 0.2)
  
positive.code: 
  (defconstant +target-fps+ 30.0)
  (defconstant +time-step+ (/ +target-fps+))
  
  (defclass actor ()
    ((x
  
negative.code:     #'(lambda ()
          (+ heading (random .3) -0.15))))
  
  (defclass environment ()
    ((actors
      :initarg :actors
      :accessor actors
      :initform nil)
     (time-step
      :initarg :time-step
      :accessor time-step
      :initform (error "must specify time-step"))))
  
  (defclass bounded-environment (environment)
    ((x-min
      :initarg :x-min
      :accessor x-min
      :initform (error "must specify boundaries"))
     (x-max
      :initarg :x-max
      :accessor x-max
      :initform (error "must specify boundaries"))
     (y-min
      :initarg :y-min
      :accessor y-min
      :initform (error "must specify boundaries"))
     (y-max
      :initarg :y-max
      :accessor y-max
      :initform (error "must specify boundaries"))))
  
  (defmethod update ((environment environment))
    (dolist (actor (actors environment)) (update actor)))
  
  (defmethod add-actor ((environment environment) (actor actor))
    (setf (environment actor) environment)
    (setf (actors environment) (cons actor (actors environment))))
  
  (defun make-medium-herd-world ()
    (let ((world (make-instance 'environment :time-step +time-step+)))
      (dotimes (i 25)
        (add-actor world (make-instance 'sheep)))
      world))
  
  (defparameter *medium-herd-world* (make-medium-herd-world))
  
  (defun main ()
    (within-main-loop
     (let ((runningp t)
           (environment *medium-herd-world*)
           (window (make-instance 'gtk-window
                                  :type :toplevel
                                  :title "Village"))
  