Life game by Tomac

t=(s=readline()).length;for(u=1;l=readline();u++)s+=l;for(i=0;i<u*t;i++){j=i%t;if(!j)p="";x=s.charAt(i);o=0;for(m=9;m--;){a=(i-j)/t+(m-m%3)/3-1,b=j+m%3-1;if(a<0||a>=u||b<0||b>=t)continue;o+=s.charAt(a*t+b)-0}if((x-0&&o>2&&o<5)||!(x-0||o-3))p+=1;else p+=0;if(j==t-1)print(p)}

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

download

return top