Transferring the DNA of bacteria from generations Introduction

Scientists have recently found a new type of bacteria that replicates in odd ways. To reproduce, two bacteria each split into 3 (for a total of 6) and pairs combine (resulting in 3 bacteria, two parents, one child). However, the bacteria can only split if it has a partner. For example, 2 bacteria split and combine into 3, 3 into 4, 4 into 6, etc. Additionally, when a bacteria splits, only one of the daughter cells combines with the other parent cell's daughter cells, and vice versa. In other words, if bacteria A and B split, the daughter cells will combine to be AA, AB, and BB.

The Challenge

Your challenge is to make a program that accepts or generates 4 bacteria's DNA, each with a strand in a 10-bit Quaternary format. An example DNA strand could be 0123302012. When two daughter bacteria combine, the DNA is merged in a punnet-square style (the DNA can be merged in every pair or only the AB pair, your choice). Meaning that 0 is the recessive trait, 1 is the mixed trait, and 2 is the dominant trait. However, when there is a 3, it is a mutated trait (more on this later). Starting with the 4 bacteria, have your program run 20 trials (4 splitting into 6 would be the first trial). Once it is done, have the program output through STDOUT (or equivalent) each cell's DNA on a seperate line, but only from the cells generated from the 20th trial.

Key Features


Each trial must calculate the new number of cells and each new cell's DNA (see below).
The program must output each 20th-trial cell's DNA (The 4046 new bacteria) each on a seperate line in STDOUT (or equivalent).
The bacteria must each replicate in the method stated above. (A and B split into AA, AB, and BB).


How the DNA is Passed on

The DNA is passed from the parents to child in a punnet-square style where:


0 is a recessive trait (rr).
1 is a mixed trait (Rr).
2 is a dominant trait (RR).


If one of the traits is a 3 (a mutation), the ending trait is decided randomly, but if both are 3,the ending trait is a 3. Parents can be decided randomly or in order (A &amp; B, C &amp; D, etc).

Example:

    |   DNA A    |   DNA B    | DNA C (Child) |
    | 0123311200 | 1203123213 |  0113012203   |


Scoring

This is code golf, so shortest character count wins! For legibility, please include a version that separates the code onto multiple lines, if possible. If the challenge is not explained well or you have suggestions, post a comment!

Here is an example program (in java) that successfully completes the challenge: Ideone Link.
Haskell -- 349

import Control.Monad
import System.Random
import Data.List
a=[0,1,2,3,3,1,1,2,0,0]
b=[a,a,a,a]
f 3 _=randomRIO(0,3)
f _ 3=randomRIO(0,3)
f x y=return$div(x+y)2
z::[Integer]-&gt;[Integer]-&gt;IO[Integer]
z x y=zipWithM f x y
c=filter(\x-&gt;length x==2).subsequences
r=sequence.map(\x-&gt;z(x!!0)(x!!1)).c
y=foldr(&lt;=&lt;)return.replicate 20
main=y r b&gt;&gt;=mapM_ print


Try it online with nicer looking source code: http://ideone.com/9FUMLd

The online example does only till 2 instead of 20 because of ideone's time limit.