text:
Draw the Stickman Wars

Picture of me drafting this challenge with my advanced drawing skills.
Background
The Stickman wars happened long ago, when Earth's dominant species was made of nothing but sticks. Historians regret the fact that there were no painters or cameras back then, we could use some pictures of that war in today's history books. That's where your coding powers become useful. Stickmen are very easily drawed and Historians managed to find some data about how many stickmen fought the wars¹. Now it's up to you to recreate an image of the moment right before the war began!
Here are the brave stickmen involved in the war:

  O  /
|/|\/
| |
 / \  Swordsman

 O A
/|\|
 | |
/ \| Spearman

   .
 .' *.
 ' O *
' \|/ .
.  |  *
'./ \*. Mage

 O
/|\
 |
/ \ Villager

 O
/|\
/ \ Infant

Input
Receive via stdin or equivalent a representation of every stickman who appeared on each side of the battlefield. For example, if two Swordmen fought on the right side and two spearmen on the left side, your input can be {Sword: 2}, {Spear: 2}, [2,0,0,0,0], [0,2,0,0,0] or a "WW", "SS".
Output
A representation of every brave stickmen in a battle field, according to the rules below. It can be shown on stdout or saved to a file, whatever rocks your boat.
Rules

On the left side will be every stickmen of the first array/string/object your program received.
Those stickmen must look exactly like the ones shown before on this question.
The order of the left side army must be Infants Villagers Mages Swordsmen Spearmen.
The right side army will behave just the same, but with the characters and the order mirrored.
Each stickman will be separated by 1 space.
Each class will be separated by 3 spaces.
The armies will be separated by 8 spaces.
Since stickmen don't fly, you must draw the ground using hyphen-minuses -.
The ground must end on the same column the last stickman of the right army ends.

Example
Let's assume my program expects two arrays with length 5 and each value in the array represents, in order, Infants Villagers Mages Swordsmen Spearmen.
Input: [1,1,2,3,1] [0,0,1,1,1]

               .       .                                                           .
             .' *.   .' *.                                                       .* '.
       O     ' O *   ' O *      O  /   O  /   O  /    O A        A O   \  O      * O '
 O    /|\   ' \|/ . ' \|/ .   |/|\/  |/|\/  |/|\/    /|\|        |/|\   \/|\|   . \|/ '
/|\    |    .  |  * .  |  *   | |    | |    | |       | |        | |      | |   *  |  .
/ \   / \   './ \*. './ \*.    / \    / \    / \     / \|        |/ \    / \    .*/ \'.
---------------------------------------------------------------------------------------

Final Considerations
Please note that standard loopholes apply and that the mage is completely asymmetrical just because.
The result of most upvoted answer will be the "cover image" of this challenge. The shortest answer by the end of the month (08/31/2014) will be selected as the winner.
This is code-golf, so the shortest code, in bytes, wins.

¹Citation needed

"the mage is completely asymmetrical just because" ... twitch... you just had to, didn't you? :P

@Doorknob ¯\ (ツ)/¯

Is ok a function with 2 array arguments or you require input parsing from a string?

TIL about overscores. Can unicode-challenged languages use dashes instead, please?

@edc65 You can receive two arrays, no problem

@JanDvorak Didn't think about that. Thanks for noting. I updated the question.

There's a column missing between the villager and the mage. Also would a representation like IVMMWWWS SWM be within the limit of "anything that helps you"?

@MartinBüttner Sure thing. I think I should reword that, though.

Any restrictions on the ground length? I think you forgot to add one hyphen there. But can it be longer than the last column containing stickmen characters?

I just wanted to say this challenge is awesome and I really appreciate that you made it.

JavaScript (E6) 336 344 356 369 424 478 522 570
Edit 6 Last edit was buggy. Bug fix and shortened. That's all I hope.
Edit 5 Finally found a way to get rid of multiply by 23 - bothered me from start. Plus another change to the input (@William shout when it's too much). Now the function expects one array parameter, containing 2 subarrays. Without this change it's 349 - still an improvement
Edit 4 Shaved some more bytes and a little change to input format.
With the new input format a missing class is represented as an empty array element. So D([1,,2,3,1],[,3,1,1,2]) instead of D([1,0,2,3,1],[0,3,1,1,2]). I think it still obeys the rules.
Edit 3 Golfed more. No changes to the algorithm, but abusing a lot of array.map and local functions to avoid for loops.
Edit 2 String compression, the right way ...
Edit Added string compression, a lot of work and not much gained. Now the mirror stickmen are generated from a template, not stored.
Made a few tries, first running. To be golfed.
NB Kolmogorow-business still to be tackled.
Test In FireFox console. Change 'return' with Add 'alert(...)' to have an output statement (albeit not useful at all)
console.log(D([[1,,2,3,1],[,3,1,1,2]]))
Output
         .       .                                                                 .
       .' *.   .' *.                                                             .* '.
       ' O *   ' O *      O  /   O  /   O  /    O A        A O  A O    \  O      * O '     O   O   O
 O    ' \|/ . ' \|/ .   |/|\/  |/|\/  |/|\/    /|\|        |/|\ |/|\    \/|\|   . \|/ '   /|\ /|\ /|\
/|\   .  |  * .  |  *   | |    | |    | |       | |        | |  | |       | |   *  |  .    |   |   |
/ \   './ \*. './ \*.    / \    / \    / \     / \|        |/ \ |/ \     / \    .*/ \.'   / \ / \ / \
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

Golfed Code
D=a=>
  (J=v=>v.join(''))((l=[r=n=' ',3,6,13,19,23]).map(_=>f=(F=f=>J(a[f].map((c,q)=>
  ("9.299.' *.87O2' O *3O21 O A O 1|0' 0|1 .|1|01 1|0|1|0 | .2|2*| |4| |1 01 0'.1 0*. 1 021 0|"[R='replace'](/[2-9]/g,x=>n.repeat(x))
   .slice(l[q]-r,l[q+1]-r)[R](/\d/g,x=>'\\/'[x^f])+n).repeat(c)+n+n
  ))+n)(0)+J([...F(1)].reverse(r-=23))+'\n'))+f[R](/./g,'¯')

Code (edit 2)
D=(a,b)=>{
  F=(s,f)=>(s=s[R](/\d/g,x=>'/\\'[x^f]),f?s:[...s].reverse().join('')),
  v="9.299.' *.87O2' O *3O21 O A O 1|0' 0|1 .|1|01 1|0|1|0 | .2|2*| |4| |1 01 0'.1 0*. 1 021 0|"
    [R='replace'](/\d/g,x=>x>1?' '.repeat(x):x),
  l=[0,3,6,13,19,23];
  for(o='',r=0;v[r];r+=23,f=F(z,1)+'  '+F(w,0),o+=f+'\n',f=f[R](/./g,'¯'))
    for(z=w=p='';p<10;++p)
      if(c=(p<5?a:b)[q=p%5])x=(v.slice(r+l[q],r+l[q+1])+' ').repeat(c)+'  ',p<5?z+=x:w+=x
  return o+f
}

Ungolfed code (1st version)
D=(a,b)=>{
  v="         .                .                    .' *.            .* '.               O  ' O *   O  / O A * O ' \\  O  A O  O /|\\' \\|/ .|/|\\/ /|\\|. \\|/ ' \\/|\\||/|\\/|\\ | .  |  *| |    | |*  |  .   | || | / \\/ \\'./ \\*. / \\  / \\|.*/ \\'.  / \\ |/ \\"
  l=[0,3,6,13,19,23,30,36,40]
  o=''
  for(r=0;r<6;++r)
  {
    z=w=''
    for(p=0;p<10;p++)
    {
      c=a[p]||b[p-5];
      if (c)
      {
        q = p<7 ? p%5 : p-2
        x = (v.slice(r*40+l[q],r*40+l[q+1])+' ').repeat(c)
        if (p<5)
          z+=x+'  ';
        else
          w=x+'  '+w
      }
    }
    f = z + '     ' + w
    o += f + '\n'
    f = '¯'.repeat(f.length-3)
  }
  return o+f
}

Python 362 353
Edit: Removing one for-loop and using the exec statement saved 9 bytes
z,x,t,j=" ",input(),str.replace,0
w=0,3,6,13,19,23
a=9*z+"."+20*z+".' *."+15*z+"o  ' o *   o  a o A o a|b' b|a .|a|ba a|b|a|b | .  |  *| |    | |a ba b'.a b*. a b  a b|"
exec"b=''\nfor c in 0,1:b+=z*8*c+t(t('   '.join([z.join([a[w[k]+j:w[k+1]+j]]*v)for k,v in enumerate(x[c])if v])[::1-2*c],'a','\/'[c<1]),'b','\/'[c])\nprint b;j+=23;"*6
print'-'*len(b)

Input:
[0,0,2,1,1],[1,0,2,1,2]

Output:
   .       .                                                   .       .
 .' *.   .' *.                                               .* '.   .* '.
 ' o *   ' o *      o  /    o A        A o  A o    \  o      * o '   * o '
' \|/ . ' \|/ .   |/|\/    /|\|        |/|\ |/|\    \/|\|   . \|/ ' . \|/ '    o
.  |  * .  |  *   | |       | |        | |  | |       | |   *  |  . *  |  .   /|\
'./ \*. './ \*.    / \     / \|        |/ \ |/ \     / \    .*/ \.' .*/ \.'   / \
---------------------------------------------------------------------------------

Noticed you use lowercase Os.

C, 418 414 404
−10 bytes thanks to ceilingcat
Example input:

stickwar.exe IVMMWWWS SWM

Example output:

               .       .                                                            .
             .' *.   .' *.                                                        .* '.
       O     ' O *   ' O *      O  /   O  /   O  /    O A        A O    \  O      * O '
 O    /|\   ' \|/ . ' \|/ .   |/|\/  |/|\/  |/|\/    /|\|        |/|\    \/|\|   . \|/ '
/|\    |    .  |  * .  |  *   | |    | |    | |       | |        | |       | |   *  |  .
/ \   / \   './ \*. './ \*.    / \    / \    / \     / \|        |/ \     / \    .*/ \'.
----------------------------------------------------------------------------------------

Golfed code:
char*s,d[8][999],*a;p,f,t,x,y,c,l;main(o,g)char**g;{for(memset(d,32,6993);o-=2,a=*++g;p+=3)for(;f=*a;t-4-o||strcpy(d[5]+p-1,"'."),p+=l&-o,f^*++a?p+=2:0)for(t=f%27%5,l=t*3%12%5+4,p+=l&o,y=6,s="(A(21;\0(A2:B(212;F\08A*B*0210KP\0-70A47/RT-A20G=CD?5D7_\0(A:(21;"+"V3'? "[t]-32;c=*s++;d[y][p+o*x]="/\\|O*'A."[c&7])x=c/16-2+(c&8?--y*0:x),c^=o-1&&!(c&6);for(y=!memset(d[6],45,p-=4);*(s=d[y++]);s[p]=0,puts(s));}

Maximal width of the battlefield is 999 (I could save 2 chars by limiting it to 99). I used a control structure of 1 byte per output character (non-space), drawing the figures from the bottom up.

1 bit for y-coordinate (either "stay" or "go up")
3 bits for x-coordinate displacement (0...4)
3 bits for output char (fortunately, there are only 8 different chars)

There are 5 offsets into the control structure.
Some other obscure bits:

The code f%27%5 translates the characters VWSMI to numbers 0, 1, 2, 3, 4
The code t*3%12%5+4 calculates the width of the stickman of type t
The code t^3|~o||(s=d[5]+p,*s--=46,*s=39) accounts for the left/right asymmetry
I use the fact that argc=3 to generate drawing direction flags 1 and -1

Ungolfed code:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char k[] = "(A(21;\0(A2:B(212;F\08A*B*0210KP\0-70A47/RT-A20G=CD?5D7_\0(A:(21;";

char d[8][999], // data of the battlefield
*s, // control string
*a; // cmdline argument
p, // position in the battlefield
f, // figure (char)
t, // type of the figure (0...4)
x,y, // coordinates while drawing the stickman
c; // control char, specifying what to draw

main(o, g) char**g; // o means "orientation" (+1, then -1)
{
    freopen("out.txt", "w", stdout);
    memset(d, ' ', 6993);

    for (; o -= 2, a=*++g;)
    {
        for (; f=*a;)
        {
            t = f%27%5;

            if (o<0)
                p += t*3%12%5+4; // go to the next stickman

            y = 6;
            for (s=k+"V3'? "[t]-32; c = *s++;) // loop over the control
            {
                if (c & 8) // bit 3: next line; set x to 0
                    --y, x = 0;
                x += c / 16 - 2; // bits 6...4: x coordinate
                if (o == -1 && !(c & 6)) // mirror \ <-> /
                    c ^= 1;
                d[y][p + o * x] = "/\\|O*'A."[c & 7];
            }
            if (t == 3 && o<0) // fix the asymmetrical mage
            {
                s=d[5]+p;
                *s--='.';
                *s='\'';
            }

            if (o>0)
                p += t*3%12%5+4; // go to the next stickman
            if (f != *++a) // is next stickman of different type?
                p += 2;
        }
        p += 3; // separate the armies
    }

    p -= 4;
    memset(d[6], '-', p); // draw the ground

    for (y = 0; *(s=d[y++]); ) // print the battle field
    {
        s[p] = 0;
        puts(s);
    }
}

Why are you able to not have the includes in the golfed version? Also why not change the semi-colon after *a to a comma? That gets rid of a warning and has the same number of bytes.

C has the "implicit declaration" rule; it's unsafe to rely on it but it works in practice so it's pretty standard in golfing. As for the semi-colon: I use the expression f=*a as the stopping condition; compiler may complain but I mean it. I cannot remove it because there should be two semicolons in the for-loop syntax.

402 bytes

Haskell, 556
Input Format
([1,1,2,3,1],[0,1,1,0,1])

Order: [Infant, Villager, Mage, Swordsman, Spearman], [Spearman, Swordsman, Mage, Villager, Infant]
Sample Output
               .        .                                                       .
             .' *.    .' *.                                                   .* '.
       O     ' O *    ' O *       O  /   O  /   O  /    O A        \  O       * O '
 O    /|\   ' \|/ .  ' \|/ .    |/|\/  |/|\/  |/|\/    /|\|         \/|\|    . \|/ '    O
/|\    |    .  |  *  .  |  *    | |    | |    | |       | |           | |    *  |  .   /|\
/ \   / \   './ \*.  './ \*.     / \    / \    / \     / \|          / \     .*/ \.'   / \
------------------------------------------------------------------------------------------

Code
(?)=replicate
v=reverse
g=map
e=length
s=foldr1
p=zip[3,3,8,6,4]$g lines[" O\n/|\\\n/ \\"," O\n/|\\\n |\n/ \\","   . \n .' *.\n ' O *  \n' \\|/ .\n.  |  *\n'./ \\*.","  O  /\n|/|\\/\n| |\n / \\"," O A\n/|\\|\n | |\n/ \\|"]
r n x a=a++(n-e a)?x
x '\\'='/';x '/'='\\';x c=c
y(w,p)=(w,g(v.dropWhile(==' ').g x.r w ' ')p)
m n(a,p)(b,q)=(a+b+n,[r(a+n)' ' c++d|(c,d)<-zip(h p)(h q)])where h=v.r(max(e p)(e q))[].v
p%c|sum c==0=(0,[])|1<2=s(m 3)[s(m 1)$d?(p!!i)|(i,d)<-zip[0..]c,d>0]
f(w,p)=p++[w?'-']
main=interact((\(a,b)->unlines.f$m 8(p%a)((g y.v$p)%b)).read)

Ungolfed
type Pic = (Int, [String])

pics :: [Pic]
pics = zip[3,3,8,6,4]$map lines[" O\n/|\\\n/ \\"," O\n/|\\\n |\n/ \\","   . \n .' *.\n ' O *  \n' \\|/ .\n.  |  *\n'./ \\*.","  O  /\n|/|\\/\n| |\n / \\"," O A\n/|\\|\n | |\n/ \\|"]

mirrorChar '\\' = '/'
mirrorChar '/' = '\\'
mirrorChar c = c

padL, padR :: Int -> a -> [a] -> [a]
padL n x a = replicate (n - length a) x ++ a
padR n x a = a ++ replicate (n - length a) x

mirrorPic :: Pic -> Pic
mirrorPic (w, pic) = (w, map (reverse . dropWhile (==' ') . map mirrorChar . padR w ' ') pic)

merge n (w1, pic1) (w2, pic2) =
  let h = max (length pic1) (length pic2)
  in (w1 + n + w2, [padR (w1 + n) ' ' line1 ++ line2 | (line1, line2) <- zip (padL h [] pic1) (padL h [] pic2)])

makeArmy :: [Pic] -> [Int] -> Pic
makeArmy pics counts | sum counts == 0 = (0, []) | otherwise = foldr1 (merge 3) [ foldr1 (merge 1) . replicate count $ pics !! i | (i, count) <- zip [0..] counts, count > 0]

addField :: Pic -> [String]
addField (w, pic) = pic ++ [replicate w '-']

main = do
  (counts1, counts2)<- return . read =<< getLine
  putStr . unlines . addField $ merge 8 (makeArmy pics counts1) (makeArmy (map mirrorPic . reverse $ pics) counts2)

I didn't test, but according to your sample output you forgot to mirror the characters on the right side

@WilliamBarbosa Fixed with a totally different solution.

Haskell (736 733 720 Bytes)
import System.Environment
import Data.List
a=1<2
h="   "
n="      "
o="    "
b (x:y)|x<0=[]|a=x:(b y)
c (x:y)|x>=0=c y|a=y
d [] _=[]
d (x:y)z|z/=x=[-5,x]++(d y x)|a=[x]++(d y x)
e x y|x< -5="        "|x<0=h|a=(([[h,h,"   .   ",n,o],[h,h," .' *. ",n,o],[h," o "," ' O * ","  O  /"," O A"],[" o ","/|\\", "' \\|/ .","|/|\\/ ","/|\\|"],["/|\\"," | ",".  |  *","| |   "," | |"],["/ \\","/ \\","'./ \\*."," / \\  ","/ \\|"]]!!(div z 5))!!(mod z 5))++" "where z=5*y+x
(§)=map
g=putStrLn
m=concat
main=do
    z<-getArgs
    let y=read§z::[Int]
    let w=sort(b y)
    let v=reverse(sort(c y))
    let u=(\(t,i)->(\s->e s i)§t)§(zip(take 6(cycle[((d w (w!!0))++[-9]++(d v (v!!0)))]))[0..5])
    mapM(\x->g(m x))u
    g(replicate(length(m(u!!0)))'-')

Call with ./stickmanwars 2 3 1 3 4 -1 3 2 4 1 0 4 2 1. The -1 marks the delimiter for the two arrays. I hope that is okay.
Well, my first code golf challenge and the first time I've used haskell for a real application after I learned it this semester at my university. Probably not even close to being the best or shortest solution but I had fun creating it and it was a good exercise :) Critique and feedback is highly appreciated.
Golfed it out of this:
import System.Environment
import Data.List

layers = [
    ["   ", "   ",  "   .   ",  "      ",  "    "],
    ["   ", "   ",  " .' *. ",  "      ",  "    "],
    ["   ", " o ",  " ' O * ",  "  O  /",  " O A"],
    [" o ", "/|\\", "' \\|/ .", "|/|\\/ ", "/|\\|"],
    ["/|\\"," | ",  ".  |  *",  "| |   "," | |"],
    ["/ \\","/ \\", "'./ \\*.", " / \\  ","/ \\|"],
    ["¯¯¯", "¯¯¯",  "¯¯¯¯¯¯¯",  "¯¯¯¯¯¯", "¯¯¯¯"]]

getLeftSide :: [Int] -> [Int]
getLeftSide (x:xs) | x < 0 = []
                   | otherwise = x : (getLeftSide xs)

getRightSide :: [Int] -> [Int]
getRightSide (x:xs) | x >= 0 = getRightSide xs
                    | otherwise = xs

addSpacing :: [Int] -> Int -> [Int]
addSpacing [] _ = []
addSpacing (x:xs) old | old /= x = [(-50),x] ++ (addSpacing xs x)
                      | otherwise = [x] ++ (addSpacing xs x)

getLayerStr :: Int -> Int -> String
getLayerStr item dimension | item < (-50) = "        "
getLayerStr item dimension | item < 0  = "   "
                           | otherwise = ((layers !! i) !! j) ++ " "
    where
        value = (item + (5 * dimension))
        i = div value 5
        j = mod value 5

main = do
    -- Read Arguments from command line
    a <- getArgs
    -- Convert command line arguments to Int array
    let args = map read a :: [Int]
    -- Get left side of the array and sort it
    let frstArray = sort $ getLeftSide args
    -- Get right side of the array and sort it mirrored
    let scndArray = reverse $ sort $ getRightSide args
    -- Concat the two sides and put a delimiter in between them
    let finalArray = (addSpacing frstArray (frstArray !! 0)) ++ [-99] ++ (addSpacing scndArray (scndArray !! 0))
    -- Create the matrix by
    -- 1. Duplicating the final array 6 times (one for each level)
    -- 2. Pair each of those 6 arrays with its level (= index)
    -- 3. Create a matrix like below:
    --
    -- 1  1  2  2  3  4  4  5 -  1  1  2  2  2  4
    -- 6  6  7  7  8  9  9 10 -  6  6  7  7  7  9
    -- 11 11 12 12 13 14 14 15 - 11 11 12 12 12 14
    -- 16 16 17 17 18 19 19 20 - 16 16 17 17 17 19
    -- 21 21 22 22 23 24 24 25 - 21 21 22 22 22 24
    -- 26 26 27 27 28 29 29 20 - 26 26 27 27 27 29
    --
    -- 4. Convert the newly calculated indices to their respective strings
    let matrix = map (\(list,i) -> map (\item -> getLayerStr item i) list) (zip (take 6 $ cycle [finalArray]) [0..5])
    -- Finaly output the matrix by concating the elements ...
    mapM (\x -> putStrLn (concat x)) matrix
    -- ... and print the ground level.
    putStrLn (replicate (length $ concat $ matrix !! 0) '¯')
    -- Exit with a new line
    putStrLn ""

Spaces around parentheses is not necessary. That seems to save you a lot.

ah okay, saved me 3 bytes, thx :)

No, a lot more.

you are right, I got a lot more just now.

05AB1E, 120 bytes
εU•1ĆÊLî˜₅ÉÈ«-—gí"Mª§ÚÇGäÒ²ĀÛNYE™Eæ]Ç€Š–ôTú™<C₄+i*∍.[½P•"
|/\.O*'0A"ÅвJ0¡ε.B€S¸XNèиJøðý€S}õζJð3×ýNiεº2äθðÜ]øð8×ý¤'-s∍ª»

Input is similar as in the example, except it's paired together (i.e. [[1,1,2,3,1],[0,0,1,1,1]]).
Try it online.
Explanation:
ε                 # Map both inner lists of the (implicit) input to:
 U                #  Pop and store the list in variable `X`
  •1ĆÊLî˜₅ÉÈ«-—gí"Mª§ÚÇGäÒ²ĀÛNYE™Eæ]Ç€Š–ôTú™<C₄+i*∍.[½P•
                 "#  Push compressed integer 842496640498468305486897242730433696271358810529289612091214532817389449608887173562606281130145674459118763657187307135640
"
|/\.O*'0A"        #  Push string " \n|/\.O*'0A"
          Åв      #  Convert the integer to this custom base-" \n|/\.O*'0A",
                  #  (short for converting it to base-length and indexing each into the string)
            J     #  Join this list of characters together to a single string
             0¡   #  And split it on "0"s

We now have a list of stick figures. I've generated the stick figures string with this program, which is a slightly modified version of this 05AB1E tip.
 ε                #  Map each stick figure to:
  .B              #   Box it (split on newlines, and append spaces to make all lines of equal length)
    €S            #   Convert each line to a list of characters
      ¸           #   Wrap the entire thing into a list
       X          #   Push input-sublist `X`
        Nè        #   Index the map-index into it
          и       #   Repeat the stick figure that many times as list
           J      #   Join each innermost list of characters together to a string
            ø     #   Zip/transpose; swapping rows/columns
             ðý   #   Join each line with a single space delimiter
               €S #   And convert each line back to a character list again
 }                #  After the inner map:
   ζ              #  Zip/transpose the list of stick figures,
  õ               #  with an empty string as filler (in case the input contained a 0)
    J             #  Join each inner list together to a string
     ð3×ý         #  Join each line with 3 spaces as delimiter
 Ni               #  If the map-index is 1 (thus the left army):
   ε              #   Map each line to:
    º             #    Mirror-reflect the line
     2ä           #    Split it into 2 equal-sized parts
       θ          #    Pop and only leave the last (mirrored) part
        ðÜ        #    Remove any trailing spaces
                  #    (necessary if the amount of infants in the left army is 0)
]                 # Close all maps and if-statements
 ø                # Zip/transpose; swapping rows/columns
  ð8×ý            # Join each line together with 8 spaces as delimiter
      ¤           # Push the last line (without popping the list itself)
       '-        '# Push string "-"
         s        # Swap so the last line is at the top of the stack
          ∍       # Extend the "-" to a length equal to that line
           ª      # Append it to the list
            »     # And join the lines by newlines
                  # (after which the result is output implicitly)

See this 05AB1E tip of mine (section How to compress large integers?) to understand why •1ĆÊLî˜₅ÉÈ«-—gí"Mª§ÚÇGäÒ²ĀÛNYE™Eæ]Ç€Š–ôTú™<C₄+i*∍.[½P• is 842496640498468305486897242730433696271358810529289612091214532817389449608887173562606281130145674459118763657187307135640.

Python (612,522,460,440)

Rev1: Rudimentary compression and base64-encoding
Rev2: Removed compression/encoding; got smaller
Rev3: More byte count reduction by inlining
Rev4: Removed unneeded input reversal on 2nd army; swapped swordsman and spearman to match spec

Each "line" is trimmed of right-padding, and this is added back in when reconstructing.
I pre-reversed the stickmen in my internal encoding because it saved me having to reverse them individually when rendering them in the code.
Sample run:
$ echo "[1,1,2,3,1],[0,0,1,1,1]"|python /tmp/g2.py
               .       .                                                            .
             .' *.   .' *.                                                        .* '.
       O     ' O *   ' O *      O  /   O  /   O  /    O A        A O    \  O      * O '
 O    /|\   ' \|/ . ' \|/ .   |/|\/  |/|\/  |/|\/    /|\|        |/|\    \/|\|   . \|/ '
/|\    |    .  |  * .  |  *   | |    | |    | |       | |        | |       | |   *  |  .
/ \   / \   './ \*. './ \*.    / \    / \    / \     / \|        |/ \     / \    .*/ \.'
----------------------------------------------------------------------------------------

Code:
c=",,A O,|/|\\,| |,|/ \\,,,\\  O, \\/|\\|,   | |,  / \\,   .  , .* '., * O ',. \\|/ ',*  |  .,.*/ \\.',,, O,/|\\, |,/ \\,,,, O,/|\\,/ \\".split(',')
r=['']*6
for b in input():
    for e,f in '/$ \\/ $\\'.split():r=[x.replace(e,f)[::-1] for x in r]
    if r[0]:r=[x+'  ' for x in r]
    for n,a in enumerate(b[::-1]):
        m=c[n*6:n*6+6]
        if a:r=[x+'   '+(' '.join([y.ljust(max(map(len,m)))]*a)) for x,y in zip(r,m)]
print '\n'.join(r+['-'*len(r[0])])

Haskell, 450
import Data.List
s=["      -"]
c=["    //-":"   O| -":"    \\\\-":s,"   / /-":"  O|| -":"   \\ \\-":s,"   '.'-":" .'  .-":" ' \\ /-":". O|| -":" * / \\-":" .*  *-":"   .*.-":s,"   || -":"   / /-":"  O|| -":"   \\ \\-":"   /  -":"  /   -":s,"   / /-":"  O|| -":"   \\ \\-":"  A|||-":s]
m '\\'='/'
m '/'='\\'
m x=x
u[]=[]
u x=x++[s,s]
f x=zipWith replicate x c>>=concat.u
k(a,b)=unlines.transpose$f a++s++s++map(map$m)(reverse$f b)
main=interact$k.read

Cool challenge! I might be able to golf that down a bit more.
Basically I'm storing the figures column wise so I can append them to each other easily, and then flip the whole array of Strings arround using Haskell's transpose.
The input format is ([Infants,Villagers,Mages,Swordsmen,Spearmen],[Infants,Villagers,Mages,Swordsmen,Spearmen])
Here is the example from the OP:
>>>echo ([1,1,2,3,1],[0,0,1,1,1]) | cg2
               .       .                                                            .
             .' *.   .' *.                                                        .* '.
       O     ' O *   ' O *      O  /   O  /   O  /    O A        A O    \  O      * O '
 O    /|\   ' \|/ . ' \|/ .   |/|\/  |/|\/  |/|\/    /|\|        |/|\    \/|\|   . \|/ '
/|\    |    .  |  * .  |  *   | |    | |    | |       | |        | |       | |   *  |  .
/ \   / \   './ \*. './ \*.    / \    / \    / \     / \|        |/ \     / \    .*/ \.'
----------------------------------------------------------------------------------------

And here is my favourite depiction of the infamous ritual infanticide during the second era!
>>>echo ([0,0,0,1,0],[5,0,0,0,0]) | cg2

  O  /
|/|\/          O   O   O   O   O
| |           /|\ /|\ /|\ /|\ /|\
 / \          / \ / \ / \ / \ / \
---------------------------------

Python (476)
A different solver from my previous one; longer, but more functional.
$ echo "[1,1,2,3,1],[0,0,1,1,1]"|python g3.py
               .       .                                                            .
             .' *.   .' *.                                                        .* '.
       O     ' O *   ' O *      O  /   O  /   O  /    O A        A O    \  O      * O '
 O    /|\   ' \|/ . ' \|/ .   |/|\/  |/|\/  |/|\/    /|\|        |/|\    \/|\|   . \|/ '
/|\    |    .  |  * .  |  *   | |    | |    | |       | |        | |       | |   *  |  .
/ \   / \   './ \*. './ \*.    / \    / \    / \     / \|        |/ \     / \    .*/ \.'
----------------------------------------------------------------------------------------

Code:
c=",,A O,|L|R,| |,|L R,,,R  O, RL|R|,   | |,  L R,   .  , .* '., * O ',. R|L ',*  |  .,.*L R.',,, O,L|R, |,L R,,,, O,L|R,L R".split(',')+['']*12
s=[sum([[4-n,5]*a+[6] for n,a in enumerate(b) if a]+[[5]],[])[::-1] for b in input()]
t=[[''.join([c[a*6+n].ljust([4,6,7,3,3,1,2][a]) for a in x]) for x in s] for n in range(0,6)]
for d,e,f in 'RL/ LR\\'.split():t=[[x[0].replace(d,f),x[1].replace(e,f)] for x in t]
t=[x[0][::-1]+x[1] for x in t]
print '\n'.join(t+['-'*len(t[0])])

authors: J. А. del Rio - слава СССР


text:
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 "alive" cell in the Game of Life and the second block as if it is the "dead" 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 "tiles" 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

I've also added them to the tag wiki now, so that in future one can simply copy it out of there. Feel free to improve the wording of that.

"Any language or tool that already does this is not allowed. (Just in case one exists.)" - Darn, I was going to post an answer in Game of Life. Edit: Heck, for fun.

this seems like a challenge suited to befunge or ><>. where is that guy that always has answers in ><>?

Are magic macros such as __LINE__ allowed?

@MartinBüttner I'll say that's fine, as long it's nothing like __SOURCE_CODE__.

@proudhaskeller I think that's me and I'm already working on one in ><> :) — it's HARD.

Is the size of the arena allowed to be hardcoded or must the program work this out for itself? That is, does the code need to work in an arbitrary size arena?

@githubphagocyte Ideally it would work in an arbitrary arena, but I may loosen that constraint since it's very hard to implement.

From the discussion happening in chat it sounds like there will be at least one entry not requiring to know its arena size - if it's possible then keep it strict...

Im really curious if someone manages a correct solution with h>1.

You would get much nicer tiles, if the scoring function were width + height, instead of the product. I am currently working on a python solution with many lines, but also a certain width. It won't be able to compete with the Perl solution.

@M.Herzkamp It's w*h because that's representative how many characters there are (which is why it's tagged [tag:code-golf])

Here's a solution in Conway's Game of Life: http://radicaleye.com/lifepage/patterns/unitcell/ucdesc.html

@mbomb007 I didn't think of that, but about the OTCA metapixel

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|$_&&$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})&&"\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|$_&&$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})&&"\n"});

Glider
my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});
my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});
my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=1}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=1}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});
my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=1}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=1}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});
my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=1}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});
my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});

generates:
my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});
my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});
my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=1}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});
my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=1}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=1}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});
my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=1}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=1}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});
my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\n"});my$y;INIT{$y=__LINE__;$h{++$x{$y}}{$y}=0}eval($c=q{$n=0;$o++;for$i(-1..1){$n+=$i|$_&&$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})&&"\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&&$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<;;;;;;++$y;map{$i{$y}+=$h{$y+$_}}(-$a-1..-$a+1,-1,1,$a-1..$a+1);print'BEGIN{++$v}eval($c=q<',$c,'>);',!($y%$a)&&"\n">);
BEGIN{$a||=$v,$h{++$x}=0}eval($c=q<$n=$i{++$z};print'BEGIN{$a||=$v,$h{++$x}=',$n==2?$h{$z}:$n==3||0,'}eval($c=q<',$c,'>);',!($z-$y)&&"\n">);

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

JavaScript ES6 (239 x 1 characters per cell)
Dead cell:
f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');

Alive cell:
f=e=>{S=S||[],j=S.length,S[j]=1,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');

Only difference being S[j]=0 for dead and S[j]=1 for alive cells.
Grid size is controlled with variables W (width) and H (height). Cells outside grid are dead.
Commented version
f=r=>{
    S=S||[],    // cell states
    j=S.length, // current index
    S[j]=1,     // state of this cell
    W=5,        // width of grid
    H=6;        // height of grid
    if (j+2 > W*H)  // if last cell
        /* Loop all cells and gather code for output */
        for (i in S)
            /* Function source with state replaced */
            r +=("f="+f+";f('');").replace(/0|1/, ~~[S[i],1] // lookup table
                [~~S[i-W] + ~~S[+i+W] + // +i to convert from int to string
                ~~(i % W ? S[--i] + S[i-W] + S[W+i++] : 0) +
                ~~(i % W < W-1 ? S[++i] + S[i-W] + S[W+i--] : 0)-2]),
            r = ++i % W ? r : (console.log(r), "")
};
f(''); // call current cell function to set state of the cell

Glider (5 x 6 grid)
f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');
f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=1,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');
f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=1,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');
f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=1,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=1,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=1,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');
f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');
f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');

Outputs next generation:
f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');
f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');
f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=1,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=1,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');
f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=1,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=1,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');
f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=1,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');
f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');f=e=>{S=S||[],j=S.length,S[j]=0,W=5,H=6;if(j+2>W*H)for(i in S)e+=("f="+f+";f('');").replace(/0|1/,~~[S[i],1][~~S[i-W]+~~S[+i+W]+~~(i%W?S[--i]+S[i-W]+S[W+i++]:0)+~~(i%W<W-1?S[++i]+S[i-W]+S[W+i--]:0)-2]),e=++i%W?e:(console.log(e),"")};f('');

The 's==0&&' in '(v<2||v>3?0:s==0&&v==3?1:s)' seems to be redundant.

@Thaylon Thanks for comment, I will check that out. I am currently making several improvements. Looks like next version is going to be ~300 characters.

@mbomb007 No. | is bitwise operator and works only with numbers. || is logical operator that returns left side if it's "trueish", right side otherwise.

Python, 67x33 = 2,211
Note, that this is my pretty version, where I added a line of "#" to every other line in a life cell, and " " to every other line in a dead cell. Also, the cells are separated by "#" lines. This way, you can place an initial configuration in a text file, e.g. GOL.py, and look at it with a tiny font to see what is going on each step. To get to the next step, execute python GOL.py > GOL1.py;mv GOL1.py GOL.py and have a look again.
My solution works on a grid of arbitrary size and assumes periodic boundary conditions. I haven't tested varying line widths, but there definitely is capability for that.
I should also mention, that the success of this solution depends on __del__ being called when a is destroyed at the end of the program. The Python documentation states

It is not guaranteed that __del__() methods are called for objects
  that still exist when the interpreter exits.

So, I just hope, that this not only works with my interpreter.
Live cell:
c=['import sys;o=sys.stdout.write;r=range;l=len;w=66',#############
###################################################################
'class B(list):',' def __getitem__(s,k):',#########################
###################################################################
'  return list.__getitem__(s,k%l(s))','class A(B):',###############
###################################################################
' def e(s,k,m):','  g=(s[k-1][m]+s[k+1][m]+s[k][m-1]+s[k][m+1]',###
###################################################################
'+s[k-1][m-1]+s[k-1][m+1]+s[k+1][m-1]+s[k+1][m+1])',###############
###################################################################
'  if s[k][m]==0:return 1 if g==3 else 0',#########################
###################################################################
'  return 1 if g==2 or g==3 else 0',' def u(s,i,y,b):',############
###################################################################
'  for j in r(l(s[i])):o(y+b[s.e(i,j)]*(w-l(y))+"#")',#############
###################################################################
'  print;print"#".join([b[s.e(i,j)]*w for j in r(l(s[i]))])+"#"',##
###################################################################
' def __del__(s):','  for i in r(l(s)):','   y="";b=[" ","#"]',####
###################################################################
'   for q in ["c=["]+[repr(x)+","for x in c]+[',###################
###################################################################
'"];import os;exec(os.linesep.join(c))"]:',########################
###################################################################
'    if l(y+q)>w:s.u(i,y,b);y=""','    y+=q','   s.u(i,y,b)',######
###################################################################
'   for j in r(l(s[i])):o("a[-1].append(%i);"%s.e(i,j)+" "*51)',###
###################################################################
'   print;print "#"*l(s[i])*(w+1)','if "a" not in locals():a=A()',#
###################################################################
'a.append(B())',];import os;exec(os.linesep.join(c))###############
###################################################################
a[-1].append(1);
###################################################################
Dead cell:
c=['import sys;o=sys.stdout.write;r=range;l=len;w=66',            #
                                                                  #
'class B(list):',' def __getitem__(s,k):',                        #
                                                                  #
'  return list.__getitem__(s,k%l(s))','class A(B):',              #
                                                                  #
' def e(s,k,m):','  g=(s[k-1][m]+s[k+1][m]+s[k][m-1]+s[k][m+1]',  #
                                                                  #
'+s[k-1][m-1]+s[k-1][m+1]+s[k+1][m-1]+s[k+1][m+1])',              #
                                                                  #
'  if s[k][m]==0:return 1 if g==3 else 0',                        #
                                                                  #
'  return 1 if g==2 or g==3 else 0',' def u(s,i,y,b):',           #
                                                                  #
'  for j in r(l(s[i])):o(y+b[s.e(i,j)]*(w-l(y))+"#")',            #
                                                                  #
'  print;print"#".join([b[s.e(i,j)]*w for j in r(l(s[i]))])+"#"', #
                                                                  #
' def __del__(s):','  for i in r(l(s)):','   y="";b=[" ","#"]',   #
                                                                  #
'   for q in ["c=["]+[repr(x)+","for x in c]+[',                  #
                                                                  #
'"];import os;exec(os.linesep.join(c))"]:',                       #
                                                                  #
'    if l(y+q)>w:s.u(i,y,b);y=""','    y+=q','   s.u(i,y,b)',     #
                                                                  #
'   for j in r(l(s[i])):o("a[-1].append(%i);"%s.e(i,j)+" "*51)',  #
                                                                  #
'   print;print "#"*l(s[i])*(w+1)','if "a" not in locals():a=A()',#
                                                                  #
'a.append(B())',];import os;exec(os.linesep.join(c))              #
                                                                  #
a[-1].append(0);
###################################################################
Python, 67x17 = 1,139
To get a golfed version, still with some way to recognise life cells from afar, the second print statement in lines 19 and 31 as well as every other line is deleted.
Live cell:
c=['import sys;o=sys.stdout.write;r=range;l=len;w=66',#############
'class B(list):',' def __getitem__(s,k):',#########################
'  return list.__getitem__(s,k%l(s))','class A(B):',###############
' def e(s,k,m):','  g=(s[k-1][m]+s[k+1][m]+s[k][m-1]+s[k][m+1]',###
'+s[k-1][m-1]+s[k-1][m+1]+s[k+1][m-1]+s[k+1][m+1])',###############
'  if s[k][m]==0: return 1 if g==3 else 0',########################
'  return 1 if g==2 or g==3 else 0',' def u(s,i,y,b):',############
'  for j in r(l(s[i])):o(y+b[s.e(i,j)]*(w-l(y))+"#")','  print',###
' def __del__(s):','  for i in r(l(s)):','   y="";b=[" ","#"]',####
'   for q in ["c=["]+[repr(x)+","for x in c]+[',###################
'"];import os;exec(os.linesep.join(c))"]:',########################
'    if l(y+q)>w:s.u(i,y,b);y=""','    y+=q','   s.u(i,y,b)',######
'   for j in r(l(s[i])):o("a[-1].append(%i);"%s.e(i,j)+" "*51)',###
'   print','if "a" not in locals():a=A()','a.append(B())',#########
];import os;exec(os.linesep.join(c))###############################
a[-1].append(1);
Dead cell:
c=['import sys;o=sys.stdout.write;r=range;l=len;w=66',            #
'class B(list):',' def __getitem__(s,k):',                        #
'  return list.__getitem__(s,k%l(s))','class A(B):',              #
' def e(s,k,m):','  g=(s[k-1][m]+s[k+1][m]+s[k][m-1]+s[k][m+1]',  #
'+s[k-1][m-1]+s[k-1][m+1]+s[k+1][m-1]+s[k+1][m+1])',              #
'  if s[k][m]==0: return 1 if g==3 else 0',                       #
'  return 1 if g==2 or g==3 else 0',' def u(s,i,y,b):',           #
'  for j in r(l(s[i])):o(y+b[s.e(i,j)]*(w-l(y))+"#")','  print',  #
' def __del__(s):','  for i in r(l(s)):','   y="";b=[" ","#"]',   #
'   for q in ["c=["]+[repr(x)+","for x in c]+[',                  #
'"];import os;exec(os.linesep.join(c))"]:',                       #
'    if l(y+q)>w:s.u(i,y,b);y=""','    y+=q','   s.u(i,y,b)',     #
'   for j in r(l(s[i])):o("a[-1].append(%i);"%s.e(i,j)+" "*51)',  #
'   print','if "a" not in locals():a=A()','a.append(B())',        #
];import os;exec(os.linesep.join(c))                              #
a[-1].append(0);
If there is demand, I will gladly explain the inner workings of my solution when I find the time.

I tried using <sup><sub>...</sub></sup> within a <pre><code> block. This doesn't decrease the height of a line, but the font of the text is decreased for each occurrence. Using only subscript or only superscript will make the code float down or up outside of the markup, but alternating will keep it centered vertically.

@mbomb007 It seems you found a way after all ;-)

Yeah, I think it helps the smaller program look like a square, at least.

I think it'd be nice if the golfed version was at the top of the answer, with its score listed in the header. Also, I think you could golf it more.

I put it in this order because I thought the ungolfed version more in spirit of the question (the score is mediocre at best anyways). Btw. @mbomb007 I begin to suspect that you put more time into this answer than me :P Is there any way to share the score?

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

authors: Владимир Букреев

sort: votes