@@ -0,0 +1,2063 @@
+import java.awt.*;%0Aimport java.util.*;%0A%0A// This is the basic cell that implements Conway's Game of Life%0Apublic class GrowthCell extends Cell %7B%0A    private Vector%3CCell%3E adj = null;%0A    private Color%5B%5D colors = null;%0A    private int curState, nextState;%0A    private static Random rand = new Random();%0A%0A    public GrowthCell() %7B%0A        this(rand.nextInt(4));%0A    %7D%0A%0A    public GrowthCell(int state) %7B%0A        curState = nextState = state;%0A%09adj = new Vector%3CCell%3E();%0A%09colors = new Color%5B4%5D;%0A        colors%5B0%5D = new Color(255, 255, 255);%0A        colors%5B1%5D = new Color(0, 255, 0);%0A        colors%5B2%5D = new Color(0, 127, 255);%0A        colors%5B3%5D = new Color(0, 0, 255);%0A    %7D%0A%0A    // Adds adjacent cells for polling%0A    public void addAdj(Vector%3CCell%3E cells) %7B%0A        adj.addAll(cells);%0A    %7D%0A%0A    // Return current cell state%0A    public int getState() %7B%0A        return curState;%0A    %7D%0A%0A    // Get the color corresponding to the current cell state%0A    public Color getColor() %7B%0A        return colors%5BcurState%5D;%0A    %7D%0A%0A    // Poll adjacent cells and update the next state%0A    public void update() %7B%0A        int liveCount = 0;%0A        Iterator%3CCell%3E it = adj.iterator();%0A        while (it.hasNext()) %7B%0A            Cell cell = it.next();%0A            if (cell.getState() %3E 0)%0A                liveCount = liveCount + 1;%0A        %7D%0A%0A        // Like the original, but if we remain alive, we grow%0A        if (curState %3E 0 && (liveCount == 2 %7C%7C liveCount == 3))%0A            nextState = curState + 1;%0A        else if (curState == 0 && liveCount == 3)%0A            nextState = 1;%0A        else%0A            nextState = 0;%0A%0A        if (nextState %3E 3)%0A            nextState = 3;%0A    %7D%0A%0A    // Built-in factory: create a new cell with a random state%0A    public Cell divide() %7B%0A        return divide(rand.nextInt(2));%0A    %7D%0A%0A    // Built-in factory: create a new cell with given state%0A    public Cell divide(int state) %7B%0A        return new GrowthCell(state);%0A    %7D%0A%0A    // Advance cell to the previously calculated next state%0A    public void sync() %7B%0A        curState = nextState;%0A    %7D%0A%7D%0A

New cell type: Growth