示例#1
0
 //generates bacteria like pattern and never stabilizes
 void ApplyRuleOfLife(Cell currCell, ref Cell newCell, int activeNeighbors, int numNeighbors)
 {
     if (numNeighbors < 3)
     {
         numNeighbors = 3;
     }
     newCell = currCell;
     if (currCell.Active() && (activeNeighbors > numNeighbors - 1 || activeNeighbors < numNeighbors - 2))
     {
         newCell.InitCell(currCell.XPos, currCell.YPos, false);
     }
     else if (!currCell.Active() && activeNeighbors == numNeighbors - 1)
     {
         newCell.InitCell(currCell.XPos, currCell.YPos, true);
     }
 }