Skip to content

Instantly share code, notes, and snippets.

@deanh
Created November 22, 2010 19:36
Show Gist options
  • Save deanh/710506 to your computer and use it in GitHub Desktop.
Save deanh/710506 to your computer and use it in GitHub Desktop.
HELLO SNOW!
#!/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