25.3 Automatic Algorithm Animation

Because of the large collection of algorithms to be animated in the Animated Algorithms project, we initially investigated the possibility of automatically generating animations based on pseudocode. In the following we first present Brown's "three dimensions of algorithm animation" to list the requirements for the ideal algorithm animation. These requirements explain why it is almost impossible to produce educationally appealing algorithm animations automatically. We then discuss our own not too successful efforts to nevertheless implement an automatic animation system.

Brown [Bro88] defines the three dimensions of algorithm animation as transformation, persistence and content (fig. II.23) .


Figure II.23 Brown's dimensions of algorithm animation [Bro88]

The instructionally best animation is placed in the upper right quadrant of figure II.23. This ideal animation displays changes in the state of the variables incrementally (transformation), shows a history of the evolution in the execution state from the beginning until the actual moment (persistence), and not only contains a direct mapping of variables to objects on the screen, but also shows synthetic metastructures of the algorithm as a performance analysis (content).

Knowing about the difficulties of automatic algorithm animation generation, we nevertheless decided to try developing our own system. We facilitated the task by narrowing the problem domain. A student wrote a HyperCard prototype of an automatic system for sorting algorithms. But although he did an impressive job and delivered a workable system, its animations were far inferior to the manually developed ones.



Figure II.24 automatic algorithm animation: general control card (top)
and automatically generated animation of bubble sort (bottom)

Fig. II.24 contains the main control card of the automatic animation generation system and a bubble sort animation that has been generated automatically, based on the executable HyperTalk description of the algorithm in fig. II.25. The top of figure II.24 illustrates the control flow of our automatic algorithm animation system. After programming the algorithm in HyperTalk, the system parses the algorithm and identifies variables that can be animated. It is then up to the user to link selected variables to predefined display elements, which in turn are then mapped into so-called "regions", i.e., predefined views.


Figure II.25 Bubble sort in HyperTalk as basis for automatic algorithm animation

This system works only for animating directly displayed variables. The animation is updated each time the displayed variable is accessed by the program. Because of its internal structure, the automatic animation generation system delivers usable unified view-based animations[30], but the results are insufficient for our more ambitious structure-based approach. Obviously, it is almost impossible to produce animations of upper right quadrant quality of fig. II.23 automatically, as these require in-depth knowledge of the inner workings of the algorithm. Additionally, the runtime performance is poor, as the algorithm is interpreted and animated at runtime. We therefore decided not to use automatic algorithm animation for the Animated Algorithms project, but to concentrate on the manual generation of instructive, appealing animations that contain a maximum of desirable qualities as defined in the three dimensions of algorithm animation. We were confirmed in our decision by Lin [Lin91] who describes a framework for automatic algorithm animation. Lin explicitly states that a system like the one he implements is only able to graphically display internal data structures, but not to automatically add educationally enriched representations of the algorithm. Lin's system is similar in that aspect to our own previously described automatic algorithm animation system. Finally, an automatic algorithm animation system is only able to generate animations of programs, i.e. executable implementations of algorithms, and not of the algorithms itself. According to the taxonomy of Price, Baecker and Small [Pri93] we can thus only automatically produce program visualizations, but not algorithm animations.