Exemplo n.º 1
0
        public override int Transition(int state, Neighbors neighbors)
        {
            switch (state)
            {
            case 0:
                return(0);

            case 1:
                return(2);

            case 2:
                return(3);

            case 3:
                switch (neighbors.CountNeighborsOnState(1))
                {
                case 1:
                case 2:
                    return(1);

                default:
                    return(3);
                }

            default:
                return(0);
            }
        }
        public override int Transition(int state, Neighbors neighbors)
        {
            if (state == 1)
            {
                return(2);
            }
            if (state == 2)
            {
                return(0);
            }
            if (neighbors.CountNeighborsOnState(1) == 2)
            {
                return(1);
            }

            return(0);
        }