Пример #1
0
        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));
        }
Пример #2
0
 public override int GetRange(int neighborsSize, int states)
 {
     return(TwoStateCount.TwoStateCountRange(4));
 }