Created
November 22, 2010 19:36
-
-
Save deanh/710506 to your computer and use it in GitHub Desktop.
HELLO SNOW!
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
#!/usr/bin/env ruby -w | |
# | |
# IT'S SNOWING! xo, hdh. | |
require 'curses' | |
include Curses | |
class Snow | |
def initialize | |
draw | |
end | |
def draw_ground | |
0.upto(Curses.cols - 1) do |i| | |
setpos(Curses::lines - 10, i) | |
addstr("_") | |
end | |
end | |
def draw(num = 100) | |
draw_ground | |
1.upto(num) do |i| | |
setpos(rand(Curses::lines - 10), rand(Curses::cols)) | |
addstr(".") | |
end | |
refresh | |
end | |
end | |
init_screen | |
begin | |
snow = Snow.new | |
loop do | |
snow.draw | |
stdscr.clear | |
end | |
ensure | |
close_screen | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment