Tetris by kimiyuki

i,a=3,[*$<]<< s=?#*10+$/
i+=1 while(0..3).all?{|j|a[i+2+j]=~/#{a[j].tr' #','. '}/}
4.times{|j|a[i+=1]=a[i].split('').zip(a[j].split'').map(&:max)*''}
a.delete s
puts [' '*10]*(19-a.size),a[4..-1]

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return top