Last active
December 14, 2015 20:19
-
-
Save ali/5143317 to your computer and use it in GitHub Desktop.
Yay!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CAKE = <<-OMGCAKE | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| | | |
|~~~~~~~~~~~~~~~~~~~~~~~~~~~| | |
| | | |
|~~~~~~~~~~~~~~~~~~~~~~~~~~~| | |
| | | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
HAPPY BIRTHDAY, NATE! | |
OMGCAKE | |
def get_candles | |
n = 5 | |
width = CAKE.split("\n")[0].length | |
spacing = " " * (width/n - 1) | |
light = ["*", "'", "~"][rand(3)] | |
lights = ([light] * n).join(spacing).center(width) | |
candles = (["|"] * n).join(spacing).center(width) | |
"#{lights}\n#{candles}" | |
end | |
while 1 | |
print "\e[2J\e[f" # Clears the terminal | |
puts get_candles | |
puts CAKE | |
sleep(1.0/24.0) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@nathan