From: Shan-leung Maverick WOO Date: 2001-07-20T00:07:15+09:00 Subject: [ruby-talk:18125] Re: An exercise in minimalism OK, humbly this is _much_ longer than Chris Moline's: > k=$*[0].to_i;n=k/2;r=-n..n;r.each{|i|r.each{|j|putc i.abs+j.abs<=n ? "#":" "if k%2+j.abs!=0};puts} It should be exactly 98 characters. This constraint approach generalizes quite well for various patterns. You can change the condition to fit the problem definition. Say to get a circle: (formatted for human) k = $*[0].to_i n = k/2 r = -n..n r.each { |i| r.each { |j| putc i**2 + j**2 <= n**2? "#" : " " if k % 2 + j.abs != 0 } puts } or try this condition instead: putc (((i % 2 == 1 && i.abs <= j.abs) || (j % 2 == 1 && j.abs <= i.abs)) ? "#" : " ") if k % 2 + j.abs != 0 Cheers! -- All the best, Maverick Woo