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

julia example
(julia example)
Line 66:
}
}</lang>
 
=={{header|Julia}}==
<lang julia>rocket() = println(" /..\\\n |==|\n | |\n | |\n",
" | |\n /____\\\n | |\n |SATU|\n | |\n",
" | |\n /| | |\\\n / | | | \\\n /__|_|__|__\\\n /_\\/_\\\n")
 
exhaust() = println(" *****")
cls() = print("\x1B[2J")
curup(n) = print("\e[$(n)A")
curdown(n) = print("\e[$(n)B")
 
function countdown(secs)
print("Countdown...T minus ")
for i in secs:-1:1
print(i, "... ")
sleep(1)
end
print("LIFTOFF!")
end
 
engineburn(rows) = (println("\n"); for i in 1:rows exhaust(); sleep(1.0 - 0.03 * i); end)
 
testrocket() = (cls(); rocket(); curup(16); countdown(7); curdown(13); engineburn(30))
</lang>{{out}}
<pre>
Countdown...T minus 7... 6... 5... 4... 3...
/..\
|==|
| |
| |
| |
/____\
| |
|SATU|
| |
| |
/| | |\
/ | | | \
/__|_|__|__\
/_\/_\
</pre>
 
=={{header|Perl 6}}==
4,108

edits