Skip to content

Instantly share code, notes, and snippets.

@yohfee
Created November 10, 2011 16:07
Show Gist options
  • Select an option

  • Save yohfee/1355224 to your computer and use it in GitHub Desktop.

Select an option

Save yohfee/1355224 to your computer and use it in GitHub Desktop.
Have a nice pocky day!
# coding: utf-8
require 'curses'
SPACE = ' '
BARS = ' | | | | | | | | | | '
NUMBERS = ' 1 2 3 4 5 6 7 8 9 1 0 '
BLANK = [
SPACE,
SPACE,
SPACE,
SPACE
]
LOGO = [
' , _ | ____, /',
' | / \ --+-- , / --- \ / ',
' | | | /| \ | / \ ',
' | \_/ / + \ / ----- / '
]
def tick
sleep 0.3
end
def wait
sleep 1
end
def display(lines, header = BLANK)
Curses.clear
(header + lines).each_with_index do |line, index|
row = Curses.lines / 2 + index - lines.size / 2
col = Curses.cols / 2 - line.size
Curses.setpos row, col
Curses.addstr line
end
Curses.refresh
end
def main
Curses.init_screen
display [
SPACE,
BARS,
SPACE
]
wait
display [
' | ',
' | | | | | | | | | ',
' 1 '
]
tick
display [
' | ',
' | | | | | | | | | ',
' 1 2 '
]
tick
display [
' | ',
' | | | | | | | | | ',
' 1 2 3 '
]
tick
display [
' | ',
' | | | | | | | | | ',
' 1 2 3 4 '
]
tick
display [
' | ',
' | | | | | | | | | ',
' 1 2 3 4 5 '
]
tick
display [
' | ',
' | | | | | | | | | ',
' 1 2 3 4 5 6 '
]
tick
display [
' | ',
' | | | | | | | | | ',
' 1 2 3 4 5 6 7 '
]
tick
display [
' | ',
' | | | | | | | | | ',
' 1 2 3 4 5 6 7 8 '
]
tick
display [
' | ',
' | | | | | | | | | ',
' 1 2 3 4 5 6 7 8 9 '
]
tick
display [
' | ',
' | | | | | | | | | ',
NUMBERS
]
tick
display [
SPACE,
BARS,
NUMBERS
]
wait
display [
SPACE,
' \ \ \ \ \ / / / / / ',
NUMBERS
], LOGO
wait
display [
SPACE,
BARS,
NUMBERS
], LOGO
Curses.getch
rescue
Curses.close_screen
end
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment