And another bit:
b[i][e]=(n==2?b[i][e]:n==3?o:f
becomes:
n!=2?b[i][e]=n==3?o:f:f
···
----
The z array can be reduced further
q=(m=[-1,0,1])-[0];(m*2+q).sort.zip(m+q+m).map{
becomes:
m=[-1,0,1]*3;(m.sort.zip(m)-[[0,0]]).map{
----
Then, the calculation of n can be improved by using separate variables:
n=((m.sort.zip(m)-[[0,0]]).map{|x|(c[i+x[0]]||)[e+x[1]]}-[f,u]).size
becomes:
n=((m.sort.zip(m)-[[0,0]]).map{|z,x|(c[i+z]||)[e+x]}-[f,u]).size
and then, turn it into a select statement:
n=(m.sort.zip(m)-[[0,0]]).select{|x,z|o==(c[i+x]||)[e+z]}.size
----
This leaves:
$><<"\e[2J";s,o,f,c,u=20,"#"," ";b,m=(z=0..s).map{z.map{(rand<0.3)?o:f
}},[-1,0,1]*3;until c==b;c=b.map{|z|z.dup};$><<"\e[H"<<b.map{|x|x*f}*"
";s.times{|i|s.times{|e|n=(m.sort.zip(m)-[[0,0]]).select{|x,z|o==(c[i+
x]||)[e+z]}.size;n!=2?b[i][e]=n==3?o:f:f}};sleep 0.2;end
272 Characters. I think I'll quit now.
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"<<b.map{|x|x*f}*"
";s.times{|i|s.times{|e|n=((m*2+q).sort.zip(m+q+m).map{|x|(c[i
+x[0]]||[
])[e+x[1]]}-[f,u]).size;b[i][e]=(n==2?b[i][e]:n==3?o:f)}};slee
p 0.2;endThat's 292 characters.
