public static void gameOfLife()
    {
        for(int i = 0 ; i < X; i++)
        {
            for(int j = 0; j < Y; j++)
            {
                boolean CellAlive = TwoD[i][j].alive;
                int NeighboursAlive = neighbours(TwoD[i][j]);
                
                if(CellAlive)//Alive
                {
                    if(NeighboursAlive < 2)//Under-Population
                        TwoD[i][j].alive = false;
                    else if(NeighboursAlive == 2 || NeighboursAlive == 3)//Next Generation
                        TwoD[i][j].alive = true;
                    else if(NeighboursAlive > 3)//Overcrowding
                        TwoD[i][j].alive = false;
                }
                else//Dead
                    if(NeighboursAlive == 3)//Reproduction
                        TwoD[i][j].alive = true; 
            }
        }
    }