def find_schedule_recurse(self, all_courses, req_numbers, selected_classes): if self.total_reqs_remaining(req_numbers) == 0: return selected_classes elif len(all_courses) == 0: return False for i in range(0, len(all_courses) - 1): print i course_to_add = all_courses[i] # if course is not needed in requirements all_course_reqs = CourseParser.get_requirements(course_to_add) fulfills_requirement = False for req in all_course_reqs: if req in req_numbers.keys() and req_numbers[req] > 0: fulfills_requirement = True break if not fulfills_requirement: print 'doesnt fulfill req' continue print 'ADDING COURSE' selected_classes.append(course_to_add) courses_after_selected = all_courses[i:] all_courses = courseComparator.filter_out_courses_that_overlap( course_to_add, courses_after_selected) for req in all_course_reqs: if req in req_numbers.keys() and req_numbers[req] > 0: req_numbers[req] = req_numbers[req] - 1 break return self.find_schedule_recurse(courses_after_selected, req_numbers, selected_classes)
def find_schedule_recurse(self, all_courses, req_numbers, selected_classes): if self.total_reqs_remaining(req_numbers) == 0: return selected_classes elif len(all_courses) == 0: return False for i in range(0, len(all_courses) - 1): print i course_to_add = all_courses[i] # if course is not needed in requirements all_course_reqs = CourseParser.get_requirements(course_to_add) fulfills_requirement = False for req in all_course_reqs: if req in req_numbers.keys() and req_numbers[req] > 0: fulfills_requirement = True break if not fulfills_requirement: print 'doesnt fulfill req' continue print 'ADDING COURSE' selected_classes.append(course_to_add) courses_after_selected = all_courses[i:] all_courses = courseComparator.filter_out_courses_that_overlap(course_to_add, courses_after_selected) for req in all_course_reqs: if req in req_numbers.keys() and req_numbers[req] > 0: req_numbers[req] = req_numbers[req] - 1 break return self.find_schedule_recurse(courses_after_selected, req_numbers, selected_classes)
def find_schedule_recurse(self, all_courses, req_numbers, selected_classes): if self.total_reqs_remaining(req_numbers) == 0: return selected_classes elif len(all_courses) == 0: return False for i in range(0, len(all_courses)): course_to_add = all_courses[i] # if course is not needed in requirements all_course_reqs = CourseParser.get_requirements(course_to_add) if course_to_add not in all_course_reqs: del all_courses[i] continue selected_classes.append(course_to_add) all_courses = courseComparator.filter_out_courses_that_overlap(course_to_add, all_courses) for req in all_course_reqs: req_numbers[req] = req_numbers[req] - 1 return find_schedule_recurse(all_courses, req_numbers, selected_classes)