Launch rocket with countdown and acceleration in stdout: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) (→{{header|Perl 6}}: Add a Perl 6 example) |
m (→{{header|zkl}}: tweak) |
||
Line 262: | Line 262: | ||
fcn cursor2Col(n){ print("\e[%dG".fmt(n)) } |
fcn cursor2Col(n){ print("\e[%dG".fmt(n)) } |
||
fcn |
fcn __main__{ |
||
tall,tall := rocket.counts(), tall[tall.find("\n")+1]; |
tall,tall := rocket.counts(), tall[tall.find("\n")+1]; |
||
cls(); print(rocket); cursorUp(tall); |
cls(); print(rocket); cursorUp(tall); |
||
Line 273: | Line 273: | ||
// liftoff |
// liftoff |
||
ms:=1.0; // 1 sec |
ms:=1.0; // 1 sec |
||
do(25){ |
|||
println(flame); Atomic.sleep(ms); |
println(flame); Atomic.sleep(ms); |
||
ms=(ms - 0.04).max(0); // 40 milliseconds faster than last time |
ms=(ms - 0.04).max(0); // 40 milliseconds faster than last time |
||
} |
} |
||
} |
}</lang> |
||
{{out}} |
{{out}} |
||
<pre> |
<pre> |