Numerical solutions for the propagation of cracks based on the variational theory of fracture