Launch rocket with countdown and acceleration in stdout: Difference between revisions

→‎Pascal: add some explanation
(insert →‎Pascal)
(→‎Pascal: add some explanation)
Line 296:
 
=={{header|Pascal}}==
Pascal includes the standard routine <tt>page</tt>.
However its specific behavior is implementation-defined, i. e. up to the compiler vendor.
''An'' implementation of <tt>page</tt> ''could'', for instance, translate into <tt>\014</tt> (ASCII form feed) or <tt>\033[2J\033[H</tt>, the ANSI escape sequence blanking the entire screen and moving the cursor to the upper left-hand corner.
If the terminal interprets them properly, the following <tt>program</tt> could satisfy the task’s requirements:
<lang pascal>program launchRocketWithCountdownAndAccelerationOnOutput(output);
 
Line 310 ⟶ 314:
{
Pascal, as defined by ISO standard 7185, does not provide any
facilities to time actions. NeverthelesNevertheless, most compiler vendors
invented their own `sleep` or `delay` procedures utilizing.
}
procedure sleep(n: natural);
Line 346 ⟶ 350:
drawRocket(n)
end
end.</lang>Note, conventionally main engines (liquid fuel) are ignited a few seconds prior liftoff and SRBs are ignited just at/before liftoff, so the graphical depiction of exhaust visible at T−5 is ''about'' accurate.
end.</lang>
 
=={{header|Perl}}==
149

edits