hmmm after thinking about i've decided to go with the first method becuase in my opnion it will be easier becuase to access either layer there is only one differance between the two, a 0 and 1 so i can use a vairable ot somthing else to controll which layer is being accessed at that moment plus i think it would be easier to deal with just the one array, now to work on the rules.
public void update()
{
Point currentCell = new Point(0, 0);
// phase one checks each square on the current frame layer, if within the rules then it flags that square on the update array
// rows
for (int x = 0; x < 10; x++)
{
// columbs
for (int y = 0; y < 10; y++)
{
// tallys up neighbers (and sets the count to zero)
int celltally1 = 0;
int celltally2 = 0;
currentCell.X = x;
currentCell.Y = y;
// checks all neighbering cells
// left
if (currentCell.X > 0)
{
if (pGrid[currentCell.X - 1, currentCell.Y] >= 1)
{
celltally1++;
}
if (pGrid[currentCell.X - 1, currentCell.Y] >= 2)
{
celltally2++;
}
}
// up
if (currentCell.Y > 0)
{
if (pGrid[currentCell.X, currentCell.Y - 1] >= 1)
{
celltally1++;
}
if (pGrid[currentCell.X, currentCell.Y - 1] >= 2)
{
celltally2++;
}
}
// right
if (currentCell.X < 100)
{
if (pGrid[currentCell.X + 1, currentCell.Y] >= 1)
{
celltally1++;
}
if (pGrid[currentCell.X + 1, currentCell.Y] >= 2)
{
celltally2++;
}
}
// down
if (currentCell.Y < 100)
{
if (pGrid[currentCell.X, currentCell.Y + 1] >= 1)
{
celltally1++;
}
if (pGrid[currentCell.X, currentCell.Y + 1] >= 2)
{
celltally2++;
}
}
// up right
if (currentCell.Y > 0 && currentCell.X < 100)
{
if (pGrid[currentCell.X + 1, currentCell.Y - 1] >= 1)
{
celltally1++;
}
if (pGrid[currentCell.X + 1, currentCell.Y - 1] >= 2)
{
celltally2++;
}
}
// up left
if (currentCell.Y > 0 && currentCell.X > 0)
{
if (pGrid[currentCell.X - 1, currentCell.Y - 1] >= 1)
{
celltally1++;
}
if (pGrid[currentCell.X - 1, currentCell.Y - 1] >= 2)
{
celltally2++;
}
}
//down right
if (currentCell.Y < 100 && currentCell.X < 100)
{
if (pGrid[currentCell.X + 1, currentCell.Y + 1] >= 1)
{
celltally1++;
}
if (pGrid[currentCell.X + 1, currentCell.Y + 1] >= 2)
{
celltally2++;
}
}
// down left
if (currentCell.Y < 100 && currentCell.X > 0)
{
if (pGrid[currentCell.X - 1, currentCell.Y + 1] >= 1)
{
celltally1++;
}
if (pGrid[currentCell.X - 1, currentCell.Y + 1] >= 2)
{
celltally2++;
}
}
// rules fo alive cells
if (pGrid[currentCell.X, currentCell.Y] != 0)
{
// rule = less then 2 A neighbers then kill cell
if (celltally1 < 2)
{
pGridU[currentCell.X, currentCell.Y] = 0;
}
// rule = Greater then 3 A neigbers then kill cell
if (celltally1 > 3)
{
pGridU[currentCell.X, currentCell.Y] = 0;
}
// rule = less then 2 B neighbers then kill cell
if (celltally2 < 2)
{
pGridU[currentCell.X, currentCell.Y] = 0;
}
// rule = Greater then 3 B neighbers then kill cell
if (celltally2 > 3)
{
pGridU[currentCell.X, currentCell.Y] = 0;
}
// rule = if more B cells then A, convert cell to B
if (celltally2 > celltally1)
{
pGridU[currentCell.X, currentCell.Y] = 2;
}
// rule = if more A cells then B convert cell to A
if (celltally2 < celltally1)
{
pGridU[currentCell.X, currentCell.Y] = 1;
}
//// rule = if enough A cells then keep as A
//if (celltally1 > 1 && celltally1 < 4)
//{
// pGridU[currentCell.X, currentCell.Y] = 1;
//}
// //rule = if enough B cells then keep as B
//if (celltally2 > 1 && celltally2 < 4)
//{
// pGridU[currentCell.X, currentCell.Y] = 2;
//}
}
else
{
// rules for dead cells
// rule = if 3 A neighbers then make cell alive as A
if (celltally1 == 3)
{
pGridU[currentCell.X, currentCell.Y] = 1;
}
//rule = if 3 B neighbers then make cell alive as B
if (celltally2 == 3)
{
pGridU[currentCell.X, currentCell.Y] = 2;
}
}
}
}
// phase two moves the update array to the current frame array
for (int y = 0; y < 10; y++)
{
for (int x = 0; x < 10; x++)
{
pGrid[x, y] = pGridU[x, y];
}
}
// Phase three clears the update layer, as in reset
Clear();
}
*sigh* i'm not sure what to do, i've changed the grid to int so i can have two seprate cell types, (player 1 and 2) now the thing is, type 1 (or A) doesn't die off and type 2 (or B) doesn't last past the first update phase, i really don't know what's cuasing it. any ideas?