Anonymous user
Launch rocket with countdown and acceleration in stdout: Difference between revisions
Launch rocket with countdown and acceleration in stdout (view source)
Revision as of 08:11, 27 August 2019
, 4 years ago+Racket
(+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|Racket}}==
{{trans|Go}}
<lang racket>#lang racket
(define rocket #<<EOF
/\
( )
( )
/|/\|\
/_||||_\
EOF
)
(define (cls) (displayln "\x1B[2J"))
(define (print-rocket n)
(displayln rocket)
(for ([i (in-range n)]) (displayln "")))
(for ([i (in-range 5 0 -1)])
(cls)
(printf "~a =>\n" i)
(print-rocket 0)
(sleep 1))
(cls)
(printf "Liftoff!\n")
(print-rocket 1)
(sleep 1)
(void
(for/fold ([ms 1000]) ([n (in-range 2 100)])
(cls)
(print-rocket n)
(sleep (/ ms 1000))
(if (>= ms 40) (- ms 40) 0)))</lang>
=={{header|REXX}}==
|