chickadee » aima » make-step-limited-environment

make-step-limited-environmentprocedure
make-step-limited-environment stepsprocedure

Make an environment that stops simulation after a certain number of steps.

steps
The number of steps after which to stop simulating
(define make-step-limited-environment
  (case-lambda
    (() (make-step-limited-environment (default-steps)))
    ((steps)
     (let ((current-step 0))
       (lambda ()
         (set! current-step (+ current-step 1))
         (< current-step steps))))))