public override int Map(IEnumerable <int> neighbors, int states) { int count = 0; int ones = 0; int twos = 0; foreach (int state in neighbors) { ones += (state == 1) ? 1 : 0; twos += (state > 1) ? 1 : 0; count++; } int third = count / 3; int onesZeroLowMedHigh = (ones + (third - 1)) / third; int twosZeroLowMedHigh = (twos + (third - 1)) / third; return(TwoStateCount.TwoStateCountFunction(onesZeroLowMedHigh, twosZeroLowMedHigh)); }
public override int GetRange(int neighborsSize, int states) { return(TwoStateCount.TwoStateCountRange(4)); }