Skip to content

Instantly share code, notes, and snippets.

@Sixeight
Created May 1, 2014 15:47
Show Gist options
  • Save Sixeight/11454662 to your computer and use it in GitHub Desktop.
Save Sixeight/11454662 to your computer and use it in GitHub Desktop.
beer with eldritch
require "eldritch"
class Beer
def initialize(row, col)
@rows = row
@col = col
end
async def run(group)
loop do
sleep rand(0.5)
@rows.times do |row|
puts "\e[#{row};#{@col}H \e[#{row+1};#{@col}H\u{1f37a} \e[H"
sleep 0.01
end
if rand(10000) == 0
group.interrupt
break
end
end
end
end
puts "\e[2J"
rows, cols = `stty size`.split.map(&:to_i)
together do |group|
cols.times do |col|
Beer.new(rows, col).run(group)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment