chickadee » aima » make-stateful-agent-program

make-stateful-agent-programprocedure

Make an agent program that models the two-square vacuum-world, and stops cleaning.

(define (make-stateful-agent-program)
  (let ((world (make-world unknown unknown)))
    (lambda (location clean?)
      (if clean?
        (begin
          (vector-set! world location clean)
          (if (all-clean? world) 'noop (if (right? location) 'left 'right)))
        'suck))))