%----------------------- Start section(1,7:30,9). section(2,9,10:30). section(3,10:30,12). section(4,12,13:30). section(5,14:30,16). section(6,16,17:30). section(7,17:30,19). section(8,19,20:30). %---- End Section ------------ prof(p01,drSohraby). prof(p02,drDavarpour). prof(p03,engMemarian). prof(p04,engSabbaghi). prof(p05,engRabei). prof(p06,engMadani). %---- End Professor ---------- course(c01,systemProgramming,3). course(c02,softwareEnginnering,3). course(c03,dataBase,3). course(c04,algorithmDesign,3). course(c05,network,2). course(c06,operatingSystem,2). course(c07,computerArchitecture,2). course(c08,theoryOfLanguagesAndAutomota,3). course(c09,specialTopic,3). course(c10,objectOrientedProgramming,3). course(c11,logicCircuit,2). course(c12,computerGraphics1,3). course(c13,internetEnginnering,3). course(c14,microProcessor,3). %---- End Course's ----------- day(0,saturday). day(1,sunday). day(2,monday). day(3,tuesday). day(4,wendsday). day(5,thursday). day(6,friday). %---- End Day's -------------- pTime(p01,3,[1,2,3,4]). pTime(p01,4,[1,2,3,4]). pTime(p02,2,[1,2,3,4,5,6,7,8]). pTime(p02,3,[1,2,3,4]). pTime(p03,4,[1,2,3,4,5,6,7,8]). pTime(p04,4,[1,2,3,4,5,6,7,8]). pTime(p05,2,[5,6,7,8]). pTime(p05,3,[1,2,3,4,5,6,7,8]). pTime(p06,2,[5,6,7,8]). pTime(p06,3,[1,2,3,4]). pTime(p06,4,[1,2,3,4]). %---- End Present Time ------- cTen(p01,[c03,c04,c06,c08,c09,c10]). cTen(p02,[c04,c06,c09,c10]). cTen(p03,[c02,c03,c08,c09]). cTen(p04,[c01,c03,c05,c06,c09,c10,c13]). cTen(p05,[c07,c09,c11,c13,c14]). cTen(p06,[c07,c09,c12,c14]). %---- End Course Tendency ---- setCourse(StartDay,StartSection,EndDay,EndSection):-sc(StartDay,StartSection,EndDay,EndSection,[],[],SetCourseList),printTable(SetCourseList). sc(SD,SS,SD,ES,_,_,[]):-SS>ES. sc(SD,_,ED,_,_,_,[]):-SD>ED. sc(SD,9,ED,ES,C,P,L):-SD_ is SD+1,sc(SD_,1,ED,ES,C,P,L). sc(SD,8,ED,ES,C,P,[[SD,8,Prof,Course]|L]):-pTime(Prof,SD,Section),member(8,Section),not(limit(P,Prof,0)),course(Course,_,2),not(member(Course,C)),cTen(Prof,CTen),member(Course,CTen),SD_ is SD+1,sc(SD_,1,ED,ES,[Course|C],[Prof|P],L). sc(SD,1,ED,ES,C,P,[[SD,1,Prof,Course],[SD,2,Prof,Course]|L]):-pTime(Prof,SD,Section),member(1,Section),not(limit(P,Prof,1)),course(Course,_,3),not(member(Course,C)),cTen(Prof,CTen),member(Course,CTen),sc(SD,3,ED,ES,[Course|C],[Prof,Prof|P],L). sc(SD,SS,ED,ES,C,P,[[SD,SS,Prof,Course]|L]):-pTime(Prof,SD,Section),member(SS,Section),not(limit(P,Prof,0)),course(Course,_,2),not(member(Course,C)),cTen(Prof,CTen),member(Course,CTen),SS_ is SS+1,sc(SD,SS_,ED,ES,[Course|C],[Prof|P],L). sc(SD,SS,ED,ES,C,P,[[SD,SS,Prof,Course],[SD,S_,Prof,Course]|L]):-pTime(Prof,SD,Section),member(SS,Section),not(limit(P,Prof,1)),course(Course,_,3),not(member(Course,C)),cTen(Prof,Cten),member(Course,Cten),SS_ is SS+2,sc(SD,SS_,ED,ES,[Course|C],[Prof,Prof|P],L),S_ is SS+1. printTable([]). printTable([[Day,Section,Prof,Course]|List]):-day(Day,D_),write(D_),write(' | '),section(Section,S1_,S2_),write(S1_),write(' to '),write(S2_),write(' | '),course(Course,C_,_),write(C_),prof(Prof,P_),write(' | '),write(P_),nl,printTable(List). % for example : setCourse(2,1,4,8). % ----- Limited 7 Unit limit([],_,X):-X>=7. limit([P|L],P,X):-X_ is X+1,limit(L,P,X_). limit([_|L],P,X):-limit(L,P,X). % -- End All - H4mit