#!/usr/bin/ruby

#
## http://rosettacode.org/wiki/Sierpinski_carpet
#

var c = ['##']
3.times {
    c = (c.map{|x| x * 3 }             +
         c.map{|x| x + ' '*x.len + x } +
         c.map{|x| x * 3 })
}
say c.join("\n")
