Assignment 4 (Prolog)
Define Prolog facts and rules for Computing Science courses, course offerings, graduation requirements and graduation plans as follows.
- A course is known by a subject and a number.
- Some courses have other courses as prerequisites.
- A course offering is a scheduled section of a course in a particular semester, at a particular campus, with a particular weekly schedule.
- A student may not take courses that have conflicting schedules in the same semester.
- A student may not take courses at different campuses unless there is at least one hour travel time available.
- A CMPT major student requires 13 Computing Science courses to graduate including CMPT 300, CMPT 307, MACM 316 and CMPT 320.
- A CMPT major also requires courses in at least 5 of 6 breadth areas.
- A CMPT major also requires at least 3 CMPT courses numbered 400 or higher.
A student may have already received credit for some courses. Write a predicate that allows the student to work out a graduation plan, that is, a minimal set of courses offered in future semesters so that the student satisfies all the (upper division) requirements of the CMPT major.
You may find it useful to refer to the actual CS Major Requirements, which includes the list of 6 breadth areas (concentrations). However, you are only responsible for the actual simplified requirements listed above.
Hints
There are many ways to represent information in Prolog.
- Courses may be represented as atoms, such as
cmpt383
. - Sections may be represented as atoms, such as
e100
. - Semesters may be represented using SFU numeric codes, such as
1157
. - Campuses:
burnaby
,vancouver
,surrey
. - Time slots
monday(9,10)
could represent the time slot Monday 9:30-10:20.
Calendar information may be represented by facts.
cmpt_concentration(ai, [cmpt310, cmpt340, cmpt411, cmpt412, cmpt413, cmpt414, cmpt417, cmpt418, cmpt419]).
Course offerings may also be facts.
offering(cmpt383, 1161, burnaby, mwf(10)).
Schedules may use rules.
schedule(mwf(Start), [monday(Start, End), wednesday(Start, End), friday(Start, End)]) :- End is Start + 1.