示例#1
0
        public void Test()
        {
            var test = new ConwayLife(new int[, ] {
                { 1, 0, 0 }, { 0, 1, 1 }, { 1, 1, 0 }
            }).NextGeneration();

            Assert.Equal(new int[, ] {
                { 0, 1, 0 }, { 0, 0, 1 }, { 1, 1, 1 }
            }, test.Cells);
        }
示例#2
0
        public static int[,] GetGeneration(int[,] cells, int generation)
        {
            var field = new ConwayLife(cells);

            for (var i = 0; i < generation; i++)
            {
                field = field.NextGeneration();
            }
            return(field.Cells);
        }