コード例 #1
0
        void eval()
        {
            List <Cell> cells    = grid.GetCells();
            List <Cell> toChange = new List <Cell>();

            foreach (Cell c in cells)
            {
                int n = grid.GetNeighbors(c);

                if (grid.IsAlive(c))
                {
                    if (n < 2 || n > 3)
                    {
                        toChange.Add(c);
                    }
                }
                else
                {
                    if (n == 3)
                    {
                        toChange.Add(c);
                    }
                }
            }

            grid.Change(toChange);
        }