private void Flip(Cell c)
        {
            int diff = c.Living ? -1 : 1;

            if (c.Living)
                c.Living = false;
            else
                c.Living = true;

            foreach (int[] nbr in nbrs)
            {
                nrow = c.Row + nbr[0];
                ncol = c.Col + nbr[1];

                if(nrow >= 0 && nrow < rows && ncol >= 0 && ncol < cols)
                {
                    Cell nc = cells[nrow,ncol];
                    if (nc != null)
                    {
                        nc.Nbrs += diff;
                    }
                }
            }
        }
        private void InitializeAppearance()
        {
            InitializeConfiguration();

            Width = width+padX;
            Height = height+padY;

            cols = width / size;
            rows = height / size;

            cells = new Cell[rows, cols];

            lblLifespan.Content = strLifespan;
            tbLifespan.Text = lifespan.ToString();

            lblSleep.Content = strSleep;
            tbSleep.Text = sleep.ToString();

            btnStartPause.Content = strStart;
            btnStop.Content = strStop;
            btnClear.Content = strClear;

            pbar.Foreground = alive;
            pbar.Background = dead;

            for (int row = 0; row < rows; row++)
            {
                StackPanel sp = new StackPanel() { Orientation = Orientation.Horizontal };
                for (int col = 0; col < cols; col++)
                {
                    Cell c = new Cell(size, thickness, row, col, alive, dead, border);
                    c.Click += c_Click;
                    cells[row,col] = c;
                    sp.Children.Add(c);
                }
                stackpanel.Children.Add(sp);
            }
        }