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

(+Racket)
Line 189:
{{out|Sample output}}
See [https://github.com/thundergnat/rc/blob/master/img/rocket-perl6.gif rocket-perl6.gif] (offsite animated gif image)
 
=={{header|Phix}}==
<lang Phix>sequence rocket = split("""
/\
/ \
| |
| |
/|/\|\
/_||||_\
""","\n")
 
integer lines = 0, l = 0, t = 5
atom s = 1
 
while length(rocket) do
if t>0 then
rocket[$] = sprintf("T minus %d...",t)
-- allow console resize during countdown:
lines = video_config()[VC_SCRNLINES]
if l!=lines-7 then l = 0 end if
else
if l=1 then
rocket = rocket[2..$]
else
l -= (length(rocket)>6)
if length(rocket)<12 then
rocket = append(rocket," ** ")
elsif length(rocket)=12 then
rocket = append(rocket," ")
end if
end if
s = s*0.95
end if
if l=0 then
clear_screen()
cursor(NO_CURSOR)
l = lines-7
end if
position(l,1)
puts(1,join(rocket,"\n"))
sleep(s)
t -= 1
if t=0 then rocket = rocket[1..$-1] end if
end while
cursor(BLOCK_CURSOR)</lang>
 
=={{header|Racket}}==
7,813

edits