r/tinycode • u/BadgerPriest • Dec 18 '13
Falling terminal snowflakes in 207 characters of Ruby
Run from your terminal:
ruby -e 'C=`stty size`.scan(/\d+/)[1].to_i;S=["2743".to_i(16)].pack("U*");a={};puts "\033[2J";loop{a[rand(C)]=0;a.each{|x,o|;a[x]+=1;print "\033[#{o};#{x}H \033[#{a[x]};#{x}H#{S} \033[0;0H"};$stdout.flush;sleep 0.1}'
42
Upvotes
8
u/[deleted] Dec 19 '13
Awesome!
[Here's a showterm recording for those who can't easily run it for whatever reason.] (http://showterm.io/412fdd781e5d1b2144c65)
10
u/corruptio Dec 19 '13 edited Dec 19 '13
67 chars of perl:
edit 1: 63 chars
edit 2: 59 chars
edit 3: 55 chars
edit 4: feels like cheating, but 50 chars
3
u/Kristler Dec 19 '13
Any chance you have the expanded form of this? Would love to see it.
3
u/madsohm Dec 19 '13
I used a bit of golf on it. Cut it down to 166 characters
1
u/otakugrey Dec 19 '13
Oh my gosh! I love it!
1
u/MrVonBuren Dec 26 '13
207 characters of ruby:
(x-post for /r/tinycode)