Following my entry to the Obfuscated Hello World I thought it might be fun to share the underlying code. But why just show the code, lets make it a golf too!
Write a script that scrolls a string across the terminal, from right to left, settling on the left side.
Takes a string as an argument.
Prints the scrolling marquee to STDOUT. Max width of ~50 chars. Starts with 0 or 1 char showing. Some space between letters while scrolling. Stops when settled (having no extra space between word chars). Slow scroll, but not too slow (< 1s per iteration).
Running script with arg
H e l l o W o
H e l l o W o r l d
Hell o W o r l d
For a running example, try my code from the "Hello World" challenge.
Eventually I will post mine. It currently is 202 chars in Perl. Now that there are some competitors, I have posted mine in the answers.
I don't want the restrictions to be absolute, that's why I left them a little vague. The shortest script which follows the spirit of my original will win.
This game assumes
xterm environment. Should another environment prove useful, only similar environments will be compared and a separate winner may be declared for each.
Addendum (April 25, 2012)
To address some budding issues, I'm making a ruling. Your character count must include code needed to:
- Flush STDOUT (Looking at you Ruby)
sleepwith time delay of <1s (Looking at you Perl)
This may be done as command line switches to an interpreter, but those characters count in the total (sans surrounding whitespace).