Artificial Intelligence for the Metaverse: A Survey