Exercise from a course in Artificial Intelligence