The animation of user or pre created programs is one of Progranimate’s main features. The animation of the flowchart and code representation of a program is synchronised. The animation features of Progranimate aim to reinforce students’ understanding of program flow and execution in both the flowchart and code representations. These features also help students to learn effective debugging techniques, a transferable skill that should stay with the student once their abilities have graduated past the scope of Progranimate.
The animation works by stepping through a program, highlighting the flow of execution one component and line of code at a time. As each component or line of code is highlighted, Progranimate performs a relevant action relating to that component. As changes are made to a program data, it is shown as it happens via the variable and array inspectors. A console is also utilised to handle input and output from the print and read components.
For example, when a print is reached, the expression it contains is evaluated; the result is then printed to screen via the console. When a read is reached, the animation halts while the user enters data from the keyboard into the console. The variable referenced by the read component is then updated; the changes are shown in the variable inspector and animation recommences . When an assignment statement is reached, its expression is evaluated; the variable inspector is then updated appropriately. If, If_Else and While structures contain decisional components that alter the flow of execution down one of two possible paths. This is dependant on the result of the Boolean expression they contain.
The Animation Controls
The animation controls are situated on the tool bar above the workspace. They allow the user to run an animation from start to end, step though an animation one component at a time and pause or stop an animation. The animation controls are shown below in figure 20.
R
Figure 20. The animation controls.
un
Select this option to run an animation from start to end.
Step
This option steps through a program one component and line of code at a time. If an animation is running when this option is pressed, Progranimate will pause. When paused, the step function can be used to step through the remainder of a program’s execution manually. Progranimate begins a new animation if an animation is not already running when this option is selected. At any time during step mode, the user may click run to begin automatic animation from the current point onwards.
Pause
At any time during an animation the user can click pause to halt the animation. When it is paused, the user can click pause again to resume animation. The step feature can also be used to manually step through the remainder of the program’s execution.
Stop
During animation, the stop button will stop the animation. Once stop button is clicked, the current animation cannot be resumed. Once the last component (the terminator) is reached, the stop button will be automatically engaged. Once the animation has stopped, the inspector’s values will remain in the post animation state until the user performs the next mouse click. Once the next mouse click has been detected the inspectors will reset to the state they were in prior to animation. This allows for observation of the changes made by the executed program.
Speed Slider
The speed slider is used to control the speed of animation where one is slow and ten is fast. The speed slider is useful for speeding through programs that have loops with many iterations.
The Console
T
Figure 21. The input output console.
he console is activated during animation to perform input and output tasks for the print and read components. An example of the console is shown below in figure 21.
When a print component is reached, the expression it contains is evaluated. If not currently active, the console is displayed, and the result of the analysed expression is then printed within it.
When a read component is reached, the console pops up to take keyboard input from the user. At this point the program pauses until valid data has been entered. The entry is then validated to make sure it is compatible with the data type of the variable or array element referenced by the read component. Once data is entered, the on screen enter button is clicked. If the input is valid, then animation resumes, and the relevant variable or array is updated in the inspectors. If the input is invalid, an appropriate error is displayed. In this case, data must be re-entered and revalidated.
Skipping through links
In the animation tab of the advanced settings, an option is provided to skip through links at high speed. This option benefits the flowchart view only. It causes the animation to momentarily speed up through paths of flow that do not contain components. The advanced settings panel can be found on Progranimate’s file menu. For more information on the advanced settings, see section 8.0.
5.0Loading and Saving a Program
At any time except during animation, Progranimate allows programs to be loaded and saved. The load and save options are located on the tool bar and on the file menu of Progranimate.
Saving a Program
When a program is saved, all of Progranimate’s settings, including the selection of language, advanced options and its visual appearance are saved alongside program data. This means that the visual state of Progranimate at the time of saving will be retained in a file. When a file is loaded this visual state is reinstated by Progranimate, as are all of Progranimate’s other settings including language selection and advanced options.
The save feature uses the file selection method native to the operating system used.
It is recommended that when a file is saved in Progranimate, the file extension .prg is used. In the Microsoft Windows operating system, Progranimate can save and load a file with no extension, but this is not recommended.
Share with your friends: |