We argue that RoboCup can be used to improve the teaching of AI in undergraduate education. We give some examples of how AI courses using RoboCup can be implemented using a problem based approach at two different Universities. To reduce the negative aspects found we present a solution, with the aim of easing the burden of grasping the domain of RoboCup for the students, RoboSoc which is a general framework for developing simulated RoboCup agents.