Skip to content

Instantly share code, notes, and snippets.

@zaltoprofen
Created June 6, 2014 12:38
Show Gist options
  • Save zaltoprofen/9a7be37116e3d4fc841f to your computer and use it in GitHub Desktop.
Save zaltoprofen/9a7be37116e3d4fc841f to your computer and use it in GitHub Desktop.
csize = `stty size`.scan(/\d+/).map(&:to_i)
puts "\033[2J"
x = 0
Train = "\xf0\x9f\x9a\x83 "
TLength = 10
speed = 1
loop{
print "\033[2J"
print "\033[#{csize[0]};#{x}H#{Train*TLength}\033[0;0H"
x += speed
speed *= -1 if x <= 0 or x+(Train*TLength).length >= csize[1]
sleep 0.05
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment