Code that runs the Game of Life on itself Write two rectangular blocks of code, each w characters wide and h characters tall, that implement Conway's Game of Life when arranged in a grid. (w and h may be any positive integers)
For example, the two code blocks might be: (w = 3, h = 2, not actual code)
XX|
--+

and
  |
--+

Treat the first block as if it is the &quot;alive&quot; cell in the Game of Life and the second block as if it is the &quot;dead&quot; cell.
Now arrange multiple copies of these two blocks into a larger program that represents a Game of Life grid, such as this glider:
  |  |  |  |  |
--+--+--+--+--+
  |  |XX|  |  |
--+--+--+--+--+
  |  |  |XX|  |
--+--+--+--+--+
  |XX|XX|XX|  |
--+--+--+--+--+
  |  |  |  |  |
--+--+--+--+--+
  |  |  |  |  |
--+--+--+--+--+

Now here is the key point: when this code is run, the output must be the Game of Life grid that is the generation after this, using the same alive and dead code blocks for the cells.
So the output to the program above would be the next generation of the glider, which also serves as a runnable program:
  |  |  |  |  |
--+--+--+--+--+
  |  |  |  |  |
--+--+--+--+--+
  |XX|  |XX|  |
--+--+--+--+--+
  |  |XX|XX|  |
--+--+--+--+--+
  |  |XX|  |  |
--+--+--+--+--+
  |  |  |  |  |
--+--+--+--+--+

Running this would produce the next generation:
  |  |  |  |  |
--+--+--+--+--+
  |  |  |  |  |
--+--+--+--+--+
  |  |  |XX|  |
--+--+--+--+--+
  |XX|  |XX|  |
--+--+--+--+--+
  |  |XX|XX|  |
--+--+--+--+--+
  |  |  |  |  |
--+--+--+--+--+

And so on.
The process should be indefinitely repeatable and work for any arrangement of your alive and dead code blocks in a Game of Life grid.
The output grid should have the same the same dimensions as the program that it came from (5 by 6 above). Grid sizes as small as 1 by 1 should work, and they may be arbitrarily large. Naturally, an empty grid will just output itself.
Update: Being able to simulate grids of any dimensions without having to change the &quot;tiles&quot; would be ideal but since this seems very difficult I will accept answers that assume the grid is a certain size (maybe around 16*16).
The Game of Life rules are as follows:

Any live cell with less than 2 or more than 3 live (Moore) neighbors dies.
Any dead cell with exactly 3 live neighbors comes alive.
Other cells do not change.

Scoring
The challenge is to do this in the smallest code block area possible. Your score is w * h. The lowest score wins. In case of ties the highest voted answer wins.
Details

Besides the newlines needed to make things rectangular, your two code blocks (and therefore your Game of Life grid programs) should only contain printable ASCII characters (hex codes 20 to 7E, no tabs, no extra newlines).
Both code blocks must have exactly w * h characters (besides the necessary newlines) with at least a one character difference. Padding them with spaces or comments is fine. They should not change from one generation to the next.
The output should either go to a file or to stdout. There is no input.
The boundary conditions may either be periodic (where the top edge borders the bottom and the left edge borders the right) or infinite (where all out-of-bounds cells are always dead). Choose whatever suits you best.
Reading your own source code is not allowed.
Any language or tool that already does this is not allowed. (Just in case one exists.)

Note: The -|+ characters above were only used to emphasize the cell borders. Your blocks do not need any distinguishable border. However, when displaying your output it would be helpful if there was some distinguishable separation between blocks, perhaps made with a character never used in the program so it is easy to remove. e.g.
DD+DD+DD+DD
+++++++++++
AA+DD+AA+DD

instead of
DDDDDDDD
AADDAADD
Perl, w*h=233*1=233 (per cell)

Cells work in any grid size (actually even with irregular row length). Out of boundary cells are considered dead.

Dead Cell

my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});


Living Cell

my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=1}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});


Glider

my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});
my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});
my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=1}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=1}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});
my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=1}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=1}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});
my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=1}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});
my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});


generates:

my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});
my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});
my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=1}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});
my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=1}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=1}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});
my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=1}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=1}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});
my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&amp;&amp;$h{$o+$i}{$y+$_}for(-1..1)}print"my\$y;INIT{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=",$n==2?$h{$o}{$y}:$n==3||0,"}eval(\$c=q{$c});",!($o%=$x{$y})&amp;&amp;"\n"});


Explanation (not current)

# Perl has several special blocks that are executed at certain stages.
# BEGIN blocks are executed at compilation stage
BEGIN
{
  # current row index and row count in execution stage
  $y=__LINE__;
  # $x{$y} is the cell index in current row and cell count in execution stage
  # $h{..}{..} set cell to dead || alive
  $h{++$x{$y}}{$y}=1
}

# dead || alive
$v=1;
# row index
$p=__LINE__;
# write cell code to $c
$c=q{
  # reset neighbour count
  $n=0;
  # cell index
  $o++;
  # count living neighbours
  for$i(-1..1){$n+=$i|$_?$h{$o+$i}{$p+$_}:0for(-1..1)}
  # reset cell index to 0 when end of row is reached
  $o%=$x{$p};
  # dead || alive for next generation of this cell
  $v=$n==3||$n==2&amp;&amp;$v||0;
  # print the new cell
  print"BEGIN{\$y=__LINE__;\$h{++\$x{\$y}}{\$y}=$v}\$v=$v;\$p=__LINE__;\$c=q{$c};eval\$c;",$o?"":"\n"
};
# execute cell code
eval$c;


Perl, w*h=140*2=280 (per cell)

Multi-line cell is not efficient but can eliminate __LINE__.

Dead Cell

BEGIN{++$v}eval($c=q&lt;;;;;;;++$y;map{$i{$y}+=$h{$y+$_}}(-$a-1..-$a+1,-1,1,$a-1..$a+1);print'BEGIN{++$v}eval($c=q&lt;',$c,'&gt;);',!($y%$a)&amp;&amp;"\n"&gt;);
BEGIN{$a||=$v,$h{++$x}=0}eval($c=q&lt;$n=$i{++$z};print'BEGIN{$a||=$v,$h{++$x}=',$n==2?$h{$z}:$n==3||0,'}eval($c=q&lt;',$c,'&gt;);',!($z-$y)&amp;&amp;"\n"&gt;);


Living Cell

BEGIN{++$v}eval($c=q&lt;;;;;;;++$y;map{$i{$y}+=$h{$y+$_}}(-$a-1..-$a+1,-1,1,$a-1..$a+1);print'BEGIN{++$v}eval($c=q&lt;',$c,'&gt;);',!($y%$a)&amp;&amp;"\n"&gt;);
BEGIN{$a||=$v,$h{++$x}=1}eval($c=q&lt;$n=$i{++$z};print'BEGIN{$a||=$v,$h{++$x}=',$n==2?$h{$z}:$n==3||0,'}eval($c=q&lt;',$c,'&gt;);',!($z-$y)&amp;&amp;"\n"&gt;);