Numerical solution of gravitational dynamics in asymptotically anti-de Sitter spacetimes