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

Content added Content deleted
(+Racket)
Line 189: Line 189:
{{out|Sample output}}
{{out|Sample output}}
See [https://github.com/thundergnat/rc/blob/master/img/rocket-perl6.gif rocket-perl6.gif] (offsite animated gif image)
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}}==
=={{header|REXX}}==