public void Init()
 {
     // 100 021
     // 001 352
     // 111 132
     populatedGrid = new LifeGrid(3, 3);
     populatedGrid.SetCell(0, 0);
     populatedGrid.SetCell(2, 1);
     populatedGrid.SetCell(0, 2);
     populatedGrid.SetCell(1, 2);
     populatedGrid.SetCell(2, 2);
 }
 public LifeGrid Gestate()
 {
     var newLife = new LifeGrid(width, depth);
     for (int y = 0; y < depth; y++)
     {
         for (int x = 0; x < width; x++)
         {
             if (LivesInNewGeneration(IsLive(x, y), CountNeighbours(x, y)))
                 newLife.SetCell(x, y);
         }
     }
     return newLife;
 }
        static void Main(string[] args)
        {
            int generation = 0;
            int width = 79;
            int depth = 30;

            LifeGrid.LifeGrid grid = new LifeGrid.LifeGrid(width, depth);

            int t = DateTime.Now.Millisecond % 100;
            Console.WriteLine(t);
            Random r = new Random(t);

            for(int y=0; y<depth; y++)
            {
                for(int x=0; x<width; x++)
                {
                    if (r.Next(100) > 60)
                    {
                        grid.SetCell(x, y);
                    }
                }
            }

            while (true)
            {
                Console.Clear();
                Console.WriteLine(generation++);
                for(int y=0; y<depth; y++)
                {
                    for(int x=0; x<width; x++)
                    {
                        Console.Write(grid.IsLive(x, y) ? "*": " ");
                    }
                    Console.WriteLine();
                }
                grid = grid.Gestate();
                System.Threading.Thread.Sleep(500);
            }
        }
 LifeGrid getLGrid()
 {
     var g = new LifeGrid(2, 2);
     g.SetCell(0, 0);
     g.SetCell(0, 1);
     g.SetCell(1, 1);
     return g;
 }
 public void Grid_Gestates_Another_Grid()
 {
     LifeGrid grid = new LifeGrid(1,1).Gestate();
     Assert.IsInstanceOf<LifeGrid>(grid);
 }