20. Four Stroke Engine


General Description

This program is a graphics demonstration of how a four stroke engine works. It will run on a Model 'A' and 'B'. Once running, the program continues until you press 'ESC'. It only takes a few seconds to load and is great to watch. To develop the program, you may wish to add labels to the spark plugs, valves, piston etc, and a facility to freeze the display - in which case you may run out of memory on a Model 'A', but as it stands the valves open and shut, and airflow is indicated with arrows.

Detailed Description

   Lines 10-160 Main structure: the UNTIL FALSE guarantees perpetual motiom for the engine.
   170-510 The effective speed of the demonstration can be controlled by making the value of 'step' smaller in line 320. This in turn varies the number of 'frames' into the POSITION array.
   520-630 In line 570 notice the exclusive OR of the foreground graphical colour to update the graphical display.
   630-1010 Routines to move the piston.
   1020-end Draws the cylinder and provides the spark.

Educational Notes

This is a good substitute for 'chalk and talk'. If you decide not to label the various parts of the engine then you can use the program to elicit responses as to what is happening from the class.