//apply rule to get next state public int SetState(Cell Cellnghb1, Cell Cellnghb2, Cell Cellnghb3, Cell Cellnghb4, Cell currentCell) { int nextState = currentCell.GetNextState(); if (Cellnghb1.State == nextState || Cellnghb2.State == nextState || Cellnghb3.State == nextState || Cellnghb4.State == nextState) { state = nextState; } else { state = currentCell.State; } return(state); }