From: Daniel Sheppard Date: 2006-05-04T09:35:22+09:00 Subject: Re: Golfing a signature. You can shave off another 12 characters by changing the construction of the "z" array: q,z=-1..1,[];q.map{|x|q.map{|y|z<<[x,y]}};(z-=[[0,0]]).map{ q=(m=[-1,0,1])-[0];(m*2+q).sort.zip(m+q+m).map{ Firstly, z isn't used after this, so you don't need to reassign it: q,z=-1..1,[];q.map{|x|q.map{|y|z<<[x,y]}};(z-[[0,0]]).map{ But the whole thing is pointless, as it's not much better that spelling out the entire array: [[-1,-1],[-1,0],[-1,1],[0,-1],[0,1],[1,-1],[1,0],[1,1]].map { so shorten that with a zip: [-1,-1,-1,0,0,1,1,1].zip([-1,0,1,-1,1,-1,0,1]).map{ removing some repetition makes it slightly longer: [-1,-1,-1,0,0,1,1,1].zip((m=[-1,0,1])+(m-[0])+m).map{ but we can fix that: q=(m=[-1,0,1])-[0];(m*2+q).sort.zip(m+q+m).map{ ----- Also the: c[i+x[0]][e+x[1]]rescue u can be rewritten as: (c[i+x[0]]||[])[e+x[1]] ---- I also rejuggled things to move that "\n" so that it made use of the end of the line, and There was a reference to " ", which I replaced with f. I might have done some other things too, but I don't have much of a memory. $><<"\e[2J";s,o,f,c,u=20,"#"," ";b,q=(z=0..s).map{z.map{(rand<0.3)?o:f}}, (m=[-1,0,1])-[0];until c==b;c=b.map{|z|z.dup};$><<"\e[H"<