Пример #1
0
 /// <summary>
 /// Update the status of a cell according to the rules
 /// </summary>
 /// <param name="cell">The cell that will be updated according to the rules</param>
 private void UpdateCellStatus(Cell cell)
 {
     Cell[] neighbors = new Cell[8];
     neighbors[0] = GetNeighbor(cell.PosX - 1, cell.PosY - 1);//Top left
     neighbors[1] = GetNeighbor(cell.PosX, cell.PosY - 1);//Top
     neighbors[2] = GetNeighbor(cell.PosX + 1, cell.PosY - 1);//Top right 
     neighbors[3] = GetNeighbor(cell.PosX - 1, cell.PosY);//left
     neighbors[4] = GetNeighbor(cell.PosX + 1, cell.PosY);//right
     neighbors[5] = GetNeighbor(cell.PosX - 1, cell.PosY + 1);//bottom left
     neighbors[6] = GetNeighbor(cell.PosX, cell.PosY + 1);//bottom
     neighbors[7] = GetNeighbor(cell.PosX + 1, cell.PosY + 1);//bottom right
     cell.SetAliveStatus(neighbors);
 }