chickadee » aima » simulate-graph/animation

simulate-graph/animation world agent fileprocedure
simulate-graph/animation world agent file stepsprocedure
simulate-graph/animation world agent file steps width height font-size titleprocedure

Simulate the graph world, creating an animation along the way; see, for instance, <http://youtu.be/EvZvyxAoNdo>.

Requires Graphviz.

world
The world to simulate
agent
The agent that inhabits the world
file
The base-name of the animation file
steps
The steps to simulation (default: `(default-steps)'
width
Width of the animation in pixels
hight
Height of the animation in pixels
font-size
Font-size of the animation in points
title
Title of the animation
(define simulate-graph/animation
  (case-lambda
    ((world agent file)
     (simulate-graph/animation world agent file (default-steps)))
    ((world agent file steps)
     (simulate-graph/animation
       world
       agent
       file
       steps
       (default-width)
       (default-height)
       (default-font-size)
       (default-title)))
    ((world agent file steps width height font-size title)
     (let ((directory (create-temporary-directory)))
       (parameterize
         ((randomize! bsd-randomize))
         (simulate
           (compose-environments
             (make-step-limited-environment steps)
             (make-graph-animating-environment
               world
               agent
               directory
               width
               height
               font-size
               title)
             (make-finalizing-environment
               (make-animation-finalizer directory file)
               steps)
             (make-debug-environment agent)
             (make-graph-environment world agent)
             (make-graph-performance-measure world agent))))
       directory))))