program classOrganizer(input,output); uses WinCrt, Strings; const maxClasses=30; maxSections=10; maxWordSize=14; maxCombos=maxClasses*maxSections; type xindex=1..10; {in textcube} yindex=1..maxSections; {in textcube} zindex=1..maxClasses; {in textcube} wordindex=1..maxWordSize; {in textcube} intInfoIndex=1..5; {in intchart} tableDayIndex=1..10; {in tableT} tableTimeIndex=1..29; {in tableT} outputIndex=1..maxCombos; {in placedT} textcube=array[zindex,yindex,xindex,wordindex] of char; {text information} wordsize=array[zindex,yindex,xindex] of integer; {field length} intchart=array[zindex,yindex,intInfoIndex] of integer; {to place conversions} tableT=array[tableTimeIndex,tableDayIndex] of integer; {the real timetable} placedT=array[outputIndex] of boolean; {to keep track of which ID #s have been written} Ptextcube=^textcube; Pwordsize=^wordsize; Pintchart=^intchart; PtableT=^tableT; PplacedT=^placedT; var allInfo:Ptextcube; {text information about courses} h,i,j,k:integer; fieldsize:Pwordsize; {records length of words in textcube} ui,ui2:char; {UserInputs; variables for answers to user prompts} correctFieldSize:boolean; intInfo:Pintchart; numClasses:integer; timetable:PtableT; {the actual timetable} placed:PplacedT; schedule:text; filecounter:integer; {------------------------------------------------------------------------} procedure readWord(z,y,x:integer); var size:integer; begin writeln; size:=0; while not eoln do begin read(allInfo^[z,y,x,size+1]); {<= the wordindex becomes undefined here!} size:=size+1; end; fieldsize^[z,y,x]:=size; readln; writeln; end; {------------------------------------------------------------------------} procedure writeWord(z,y,x:integer); var size:integer; begin for size:=1 to fieldsize^[z,y,x] do begin write(allInfo^[z,y,x,size]); end; end; {------------------------------------------------------------------------} procedure writeFileWord(z,y,x:integer); var size:integer; begin for size:=1 to fieldsize^[z,y,x] do begin write(schedule, allInfo^[z,y,x,size]); end; end; {------------------------------------------------------------------------} procedure checkFieldSize(z,y,x:integer; letters:integer); begin correctFieldSize:=true; if fieldsize^[z,y,x]<>letters then begin writeln; write('Wrong Number of letters entered. This field must be ', letters:1); writeln(' letters long.'); writeln; correctFieldSize:=false; end; end; {------------------------------------------------------------------------} procedure userEntry(class:integer); var numSections:integer; begin repeat {****************************************************************************** * This inputs the class, term, and # sections for all of the 2D class slate. * ******************************************************************************} writeln; write('Please type a course followed by its type. Input labs, lectures,'); writeln(' and seminars'); writeln('as seperate classes.'); writeln(' (ex.) MATH 101 LAB or CANST 200 LEC'); readWord(class,1,1); for j:=1 to maxSections do begin for k:=1 to fieldsize^[class,1,1] do begin allInfo^[class,j,1,k]:=allInfo^[class,1,1,k]; end; fieldsize^[class,j,1]:=fieldsize^[class,1,1]; end; repeat write('What term(s) is '''); writeWord(class,1,1); writeln(''' offered in?'); writeln('Type 1, 2, 3, or 4 (1st, 2nd, both, or either).'); readWord(class,1,8); checkFieldSize(class,1,8,1); if not((allInfo^[class,1,8,1]='1') or (allInfo^[class,1,8,1]='2') or (allInfo^[class,1,8,1]='3') or (allInfo^[class,1,8,1]='4')) and (correctFieldSize) then begin writeln('Please enter either 1, 2, 3, or 4.'); writeln; correctFieldSize:=false; end; until (correctFieldSize); for j:=1 to maxSections do begin for k:=1 to fieldsize^[class,1,8] do begin allInfo^[class,j,8,k]:=allInfo^[class,1,8,k]; if (allInfo^[class,1,8,k]<>'4') then begin allInfo^[class,j,10,k]:=allInfo^[class,1,8,k]; fieldsize^[class,j,10]:=fieldsize^[class,1,8]; end; end; fieldsize^[class,j,8]:=fieldsize^[class,1,8] end; write('How many TOTAL sections are offered in your '''); writeWord(class,1,1); writeln('''?'); writeln; readln(numSections); writeln; write('Was the following entered correctly? If your answer is no, you '); writeln('will have to'); writeln('enter the information again.'); writeln; write('Class: '); writeWord(class,1,1); writeln; write('Term: '); writeWord(class,1,8); writeln(' (3 means both, 4 means either)'); write('TOTAL Sections: '); writeln(numSections:1); writeln; writeln('Is it correct?'); repeat readln(ui2); if not( (ui2='Y') or (ui2='y') or (ui2='N') or (ui2='n') ) then begin writeln('Enter either ''Y'' or ''N''.'); writeln; end; until (ui2='y') or (ui2='Y') or (ui2='n') or (ui2='N'); until (ui2='y') or (ui2='Y'); {**************************************************************************** * This inputs into the rest of the 2D slate, one complete entry at a time. * * It will do this until it reaches maxSections or until user is done. * ****************************************************************************} for i:=1 to numSections do begin allInfo^[class,i,9,1]:='Y'; repeat write('-------------------------------------------------------------------'); writeln('-------------'); writeln; write('Input all the following information for your '''); writeWord(class,i,1); writeln('''.'); writeln; write('If the sections were numbered from top to bottom, what would '); writeln('the section '); writeln('number for ', i:1, ' be? (ie. A1, A2, B2, etc.)'); readWord(class,i,2); if allInfo^[class,i,8,1]='4' then begin repeat write('Which term is section '''); writeWord(class,i,2); writeln(''' being offered?'); readWord(class,i,10); checkFieldSize(class,i,10,1); if not ((allInfo^[class,1,10,1]='1') or (allInfo^[class,1,10,1]='2') or (allInfo^[class,1,10,1]='3')) and (correctFieldSize) then begin writeln('Please enter a 1, 2 or 3'); writeln; correctFieldSize:=false; end; until (correctFieldSize); end; repeat write('What is the index number for section '''); writeWord(class,i,2); writeln('''? (ie. 21384, or 66669, etc.)'); readWord(class,i,3); checkFieldSize(class,i,3,5); until (correctFieldSize); repeat write('On what day(s) is section '''); writeWord(class,i,2); writeln(''' offered? This field length is 5 characters long,'); write('each corresponding to a day. Type hyphens (-) for spaces, and'); writeln(' use capitals.'); writeln(' (ex) ''M-W-F'' or ''-T-R-'' or ''---R-'''); readWord(class,i,4); checkFieldSize(class,i,4,5); if not ((((allInfo^[class,i,4,1]='M') or (allInfo^[class,i,4,1]='-')) and ((allInfo^[class,i,4,2]='T') or (allInfo^[class,i,4,2]='-')) and ((allInfo^[class,i,4,3]='W') or (allInfo^[class,i,4,3]='-')) and ((allInfo^[class,i,4,4]='R') or (allInfo^[class,i,4,4]='-')) and ((allInfo^[class,i,4,5]='F') or (allInfo^[class,i,4,5]='-')))) and (correctFieldSize) then begin writeln('MUST use capitals and hyphens (and in correct places)!'); writeln; correctFieldSize:=false; end; until (correctFieldSize); repeat write('At what time does section '''); writeWord(class,i,2); writeln(''' begin? This field length is 4 characters long'); writeln('the first two being hours, and the second two being minutes.'); writeln(' (ex.) ''0800'' or ''1400'''); readWord(class,i,5); checkFieldSize(class,i,5,4); until (correctFieldSize); repeat write('At what time does section '''); writeWord(class,i,2); writeln(''' end? This field length is 4 characters long'); writeln('the first two being hours, and the second two being minutes.'); writeln(' (ex.) ''0850'' or ''1520'''); readWord(class,i,6); checkFieldSize(class,i,6,4); until (correctFieldSize); write('In what room is section '''); writeWord(class,i,2); writeln(''' begin held in? (ex). DP 1030 or TL B 12'); readWord(class,i,7); write('Was the following entered correctly? If your answer is no, you '); writeln('will have to'); writeln('enter all of the section again.'); writeln; write('Class: '); writeWord(class,i,1); writeln; write('Section: '); writeWord(class,i,2); writeln; if allInfo^[class,i,8,1]='4' then begin write('Term : '); writeWord(class,i,10); writeln; end; write('Index #: '); writeWord(class,i,3); writeln; write('Day(s): '); writeWord(class,i,4); writeln; write('Start Time: '); writeWord(class,i,5); writeln; write('End Time: '); writeWord(class,i,6); writeln; write('Room: '); writeWord(class,i,7); writeln; writeln; writeln('Is it correct?'); repeat readln(ui2); if not( (ui2='Y') or (ui2='y') or (ui2='N') or (ui2='n') ) then begin writeln('Enter either ''Y'' or ''N''.'); writeln; end; until (ui2='y') or (ui2='Y') or (ui2='n') or (ui2='N'); until (ui2='y') or (ui2='Y'); end; end; {procedure userEntry} {------------------------------------------------------------------------} procedure convert; var idNumber:integer; timesum:integer; day:integer; term:integer; begin {**************************************** * Gives them an appropriate id number. * ****************************************} idNumber:=1; for i:=1 to maxClasses do begin for j:=1 to maxSections do begin if allInfo^[i,j,9,1]<>'N' then begin intInfo^[i,j,1]:=idNumber; idNumber:=idNumber+1; end; end; end; {************************************ * Converts the time into integers. * ************************************} for k:=5 to 6 do begin for i:=1 to maxClasses do begin for j:=1 to maxSections do begin if allInfo^[i,j,9,1]<>'N' then begin case allInfo^[i,j,k,1] of '0': case allInfo^[i,j,k,2] of '8': timesum:=1; '9': timesum:=3; end; '1': case allInfo^[i,j,k,2] of '0': timesum:=5; '1': timesum:=7; '2': timesum:=9; '3': timesum:=11; '4': timesum:=13; '5': timesum:=15; '6': timesum:=17; '7': timesum:=19; '8': timesum:=21; '9': timesum:=23; end; '2': case allInfo^[i,j,k,2] of '0': timesum:=25; '1': timesum:=27; end; end; case allInfo^[i,j,k,3] of '0': timesum:=timesum; '2': timesum:=timesum+1; '3': timesum:=timesum+1; '5': timesum:=timesum+2; end; intInfo^[i,j,k-3]:=timesum; end; {if} end; {for j} end; {for i} end; {for k} {************************************ * Converts the days into integers. * ************************************} for i:=1 to maxClasses do begin for j:=1 to maxSections do begin if allInfo^[i,j,9,1]<>'N' then begin case allInfo^[i,j,4,1] of 'M': case allInfo^[i,j,4,3] of 'W': day:=6; '-': day:=1; end; '-': case allInfo^[i,j,4,2] of 'T': case allInfo^[i,j,4,4] of 'R': day:=7; '-': day:=2; end; '-': case allInfo^[i,j,4,3] of 'W': day:=3; '-': case allInfo^[i,j,4,4] of 'R': day:=4; '-': day:=5; end; end; end; end; intInfo^[i,j,4]:=day; end; {if} end; {for j} end; {for i} {***************************************** * This converts the term into integers. * *****************************************} for i:=1 to maxClasses do begin for j:=1 to maxSections do begin if allInfo^[i,j,9,1]<>'N' then begin case allInfo^[i,j,10,1] of '1': term:=1; '2': term:=2; '3': term:=3; end; intInfo^[i,j,5]:=term; end; {if} end; {for j} end; {for i} end; {procedure convert} {------------------------------------------------------------------------} procedure initializeTimeTable; const sentinal=-1; type word=array [1..4] of char; var ui4:char; start,finish:word; i,j:integer; {- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -} function convertTime(a:word):integer; var timesum:integer; begin case a[1] of '0': case a[2] of '8': timesum:=1; '9': timesum:=3; end; '1': case a[2] of '0': timesum:=5; '1': timesum:=7; '2': timesum:=9; '3': timesum:=11; '4': timesum:=13; '5': timesum:=15; '6': timesum:=17; '7': timesum:=19; '8': timesum:=21; '9': timesum:=23; end; '2': case a[2] of '0': timesum:=25; '1': timesum:=27; end; end; case a[3] of '0': timesum:=timesum; '2': timesum:=timesum+1; '3': timesum:=timesum+1; '5': timesum:=timesum+2; end; convertTime:=timesum; end; {- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -} begin for i:=1 to 29 do begin for j:=1 to 10 do begin timetable^[i,j]:= 0; end; end; repeat writeln; writeln('Is there any time slots that you would not like to have on your timetable?'); writeln(' (This time slot will be for all the days of the week)'); readln(ui4); if not( (ui4='Y') or (ui4='y') or (ui4='N') or (ui4='n') ) then begin writeln; writeln('Enter either ''Y'' or ''N''.'); writeln; end; until (ui4='y') or (ui4='Y') or (ui4='n') or (ui4='N'); if (ui4='y') or (ui4='Y') then begin writeln; writeln('What is the start time of this slot? (ex: 0800 or 1400)'); for i:=1 to 4 do read(start[i]); readln; writeln; writeln('What is the end time of this slot? (ex: 0850 or 1520)'); for i:=1 to 4 do read(finish[i]); readln; for i:=(convertTime(start)) to (convertTime(finish)-1) do begin for j:=1 to 10 do begin timetable^[i,j]:=sentinal; end; end; end; {if} end; {procedure initializeTimeTable} {------------------------------------------------------------------------} function checkTimeSlot(day,start,finish:integer):boolean; begin if (start=finish) then begin checkTimeSlot:=true; end else begin if (timetable^[start,day]=0) and (checkTimeSlot(day,start+1,finish)) then begin checkTimeSlot:=true; end else checkTimeSlot:=false; end; end; {------------------------------------------------------------------------} procedure place(z,y:integer; var test:boolean); var p:integer; {- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -} procedure placeIn(var test:boolean; z,y,day:integer); var p:integer; begin {procedure placeIn} for p:=(intInfo^[z,y,2]) to (intInfo^[z,y,3]-1) do begin timetable^[p,day]:=intInfo^[z,y,1]; end; test:=true; end; {procedure placeIn} {- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -} begin {procedure place} test:=false; for p:=1 to 5 do begin if intInfo^[z,y,4]=p then begin case intInfo^[z,y,5] of 1: if (checktimeslot(p,intInfo^[z,y,2],intInfo^[z,y,3])) then placeIn(test,z,y,p); 2: if (checktimeslot(p+5,intInfo^[z,y,2],intInfo^[z,y,3])) then placeIn(test,z,y,p+5); 3: if ((checktimeslot(p,intInfo^[z,y,2],intInfo^[z,y,3])) and (checktimeslot(p+5,intInfo^[z,y,2],intInfo^[z,y,3]))) then begin placeIn(test,z,y,p); placeIn(test,z,y,p+5); end; end; {case} end; {if} end; {for} if intInfo^[z,y,4]=6 then begin case intInfo^[z,y,5] of 1: if ((checktimeslot(1,intInfo^[z,y,2],intInfo^[z,y,3])) and (checktimeslot(3,intInfo^[z,y,2],intInfo^[z,y,3])) and (checktimeslot(5,intInfo^[z,y,2],intInfo^[z,y,3]))) then begin placeIn(test,z,y,1); placeIn(test,z,y,3); placeIn(test,z,y,5); end; 2: if ((checktimeslot(6,intInfo^[z,y,2],intInfo^[z,y,3])) and (checktimeslot(8,intInfo^[z,y,2],intInfo^[z,y,3])) and (checktimeslot(10,intInfo^[z,y,2],intInfo^[z,y,3]))) then begin placeIn(test,z,y,6); placeIn(test,z,y,8); placeIn(test,z,y,10); end; 3: if ((checktimeslot(1,intInfo^[z,y,2],intInfo^[z,y,3])) and (checktimeslot(3,intInfo^[z,y,2],intInfo^[z,y,3])) and (checktimeslot(5,intInfo^[z,y,2],intInfo^[z,y,3])) and (checktimeslot(6,intInfo^[z,y,2],intInfo^[z,y,3])) and (checktimeslot(8,intInfo^[z,y,2],intInfo^[z,y,3])) and (checktimeslot(10,intInfo^[z,y,2],intInfo^[z,y,3]))) then begin placeIn(test,z,y,1); placeIn(test,z,y,3); placeIn(test,z,y,5); placeIn(test,z,y,6); placeIn(test,z,y,8); placeIn(test,z,y,10); end; end; end; if intInfo^[z,y,4]=7 then begin case intInfo^[z,y,5] of 1: if ((checktimeslot(2,intInfo^[z,y,2],intInfo^[z,y,3])) and (checktimeslot(4,intInfo^[z,y,2],intInfo^[z,y,3]))) then begin placeIn(test,z,y,2); placeIn(test,z,y,4); end; 2: if ((checktimeslot(7,intInfo^[z,y,2],intInfo^[z,y,3])) and (checktimeslot(9,intInfo^[z,y,2],intInfo^[z,y,3]))) then begin placeIn(test,z,y,7); placeIn(test,z,y,9); end; 3: if ((checktimeslot(2,intInfo^[z,y,2],intInfo^[z,y,3])) and (checktimeslot(4,intInfo^[z,y,2],intInfo^[z,y,3])) and (checktimeslot(7,intInfo^[z,y,2],intInfo^[z,y,3])) and (checktimeslot(9,intInfo^[z,y,2],intInfo^[z,y,3]))) then begin placeIn(test,z,y,2); placeIn(test,z,y,4); placeIn(test,z,y,7); placeIn(test,z,y,9); end; end; end; end; {procedure place} {------------------------------------------------------------------------} procedure unplace(z,y:integer); var p:integer; {- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -} procedure placeOut(z,y,day:integer); var p:integer; begin {procedure placeOut} for p:=(intInfo^[z,y,2]) to (intInfo^[z,y,3]-1) do begin timetable^[p,day]:=0; end; end; {procedure placeOut} {- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -} begin {procedure unplace} for p:=1 to 5 do begin if intInfo^[z,y,4]=p then begin case intInfo^[z,y,5] of 1: placeOut(z,y,p); 2: placeOut(z,y,p+5); 3: begin placeOut(z,y,p); placeOut(z,y,p+5); end; end; {case} end; {if} end; {for} if intInfo^[z,y,4]=6 then begin case intInfo^[z,y,5] of 1: begin placeOut(z,y,1); placeOut(z,y,3); placeOut(z,y,5); end; 2: begin placeOut(z,y,6); placeOut(z,y,8); placeOut(z,y,10); end; 3: begin placeOut(z,y,1); placeOut(z,y,3); placeOut(z,y,5); placeOut(z,y,6); placeOut(z,y,8); placeOut(z,y,10); end; end; end; if intInfo^[z,y,4]=7 then begin case intInfo^[z,y,5] of 1: begin placeOut(z,y,2); placeOut(z,y,4); end; 2: begin placeOut(z,y,7); placeOut(z,y,9); end; 3: begin placeOut(z,y,2); placeOut(z,y,4); placeOut(z,y,7); placeOut(z,y,9); end; end; end; end; {procedure unplace} {------------------------------------------------------------------------} procedure resetPlaced; var w:integer; begin for w:=1 to maxCombos do begin placed^[w]:=false; end; end; {------------------------------------------------------------------------} procedure graphicTable; var m,n,o:integer; begin {procedure graphicTable} ClrScr; o:=1000; writeln(' First Second'); writeln(' M T W R F M T W R F'); for m:=1 to 29 do begin write('| '); for n:=1 to 5 do begin if timetable^[m,n]>0 then write('* ') else write(' '); end; if not odd(m) then write('| | ') else begin if m=1 then write('| 0800 | '); if m=3 then write('| 0900 | '); if m>3 then begin write('| ', o:4, ' | '); o:=o+100; end; end; for n:=6 to 10 do begin if timetable^[m,n]>0 then write('* ') else write(' '); end; if m=20 then writeln('| (Scroll up to see whole table)') else writeln('|'); end; {for m} end; {procedure graphicTable} {------------------------------------------------------------------------} function search(value:integer; dimension:char):integer; var s,t:integer; found:boolean; location:record z,y:integer; end; begin {function search} found:=false; for s:=1 to maxClasses do begin for t:=1 to maxSections do begin if not found then begin if allInfo^[s,t,9,1]<>'N' then begin if intInfo^[s,t,1]=value then begin found:=true; location.z:=s; location.y:=t; end; end; end; end; end; if dimension='z' then search:=location.z; if dimension='y' then search:=location.y; end; {function search} {------------------------------------------------------------------------} procedure textTable; var q,r:integer; {- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -} procedure writeInfo(time,day:integer); var d,z,y:integer; begin if not (placed^[timetable^[time,day]]) then begin z:=search(timetable^[time,day],'z'); y:=search(timetable^[time,day],'y'); writeword(z,y,1); for d:=1 to (14-(fieldsize^[z,y,1])) do write(' '); write(' '); writeword(z,y,2); write(' '); writeword(z,y,4); write(' '); writeword(z,y,5); write(' '); writeword(z,y,6); write(' '); writeword(z,y,10); writeln; placed^[timetable^[time,day]]:=true; end; end; {- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -} begin {procedure textTable} resetPlaced; ClrScr; writeln(' Name Section Day Start End Term'); for q:=1 to 29 do begin for r:=1 to 10 do begin if timetable^[q,r]>0 then begin if q<29 then begin if timetable^[q+1,r]<>timetable^[q,r] then writeInfo(q,r); end else writeInfo(q,r); end; {if timetable} end; {for r} end; {for q} end; {procedure textTable} {------------------------------------------------------------------------} procedure fileTable; var u,v:integer; name:string[23]; {- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -} procedure writeFile(time,day:integer); var d,z,y:integer; begin if not (placed^[timetable^[time,day]]) then begin z:=search(timetable^[time,day],'z'); y:=search(timetable^[time,day],'y'); writeFileWord(z,y,1); for d:=1 to (14-(fieldsize^[z,y,1])) do write(schedule, ' '); write(schedule, ' '); writeFileWord(z,y,2); write(schedule, ' '); writeFileWord(z,y,4); write(schedule, ' '); writeFileWord(z,y,5); write(schedule, ' '); writeFileWord(z,y,6); write(schedule, ' '); writeFileWord(z,y,10); write(schedule, ' '); writeFileWord(z,y,3); write(schedule, ' '); writeFileWord(z,y,7); writeln(schedule); placed^[timetable^[time,day]]:=true; end; end; {- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -} begin {procedure fileTable} resetPlaced; filecounter:=filecounter+1; name:='c:\windows\timtabl.txt'; insert(Chr(filecounter),name,19); assign(schedule,name); rewrite(schedule); writeln(schedule, ' Name Section Day Start End Term Index # Room'); for u:=1 to 29 do begin for v:=1 to 10 do begin if timetable^[u,v]>0 then begin if u<29 then begin if timetable^[u+1,v]<>timetable^[u,v] then writeFile(u,v); end else writeFile(u,v); end; {if timetable} end; {for v} end; {for u} close(schedule); writeln('Information exported to a file called ''',name,'''.'); end; {procedure fileTable} {------------------------------------------------------------------------} procedure outputcontrol; var ui3:char; begin {procedure outputcontrol} repeat writeln; writeln('Which would you like to do?'); writeln; writeln(' 1. View a graphical representation of the timetable'); writeln(' 2. View a textual representation of the timetable'); writeln(' 3. Save the timetable to a file, then view the next timetable'); writeln(' 4. View the next timetable'); writeln; repeat writeln('Your choice?'); readln(ui3); until (ui3='1') or (ui3='2') or (ui3='3') or (ui3='4'); case ui3 of '1': graphicTable; '2': textTable; '3': fileTable; '4': writeln('Please wait a moment.'); end; until (ui3='3') or (ui3='4'); end; {procedure outputcontrol} {------------------------------------------------------------------------} procedure blackbox(seed:integer); var a:integer; placed:boolean; begin {procedure blackbox} if seed>=numClasses+1 then outputcontrol else begin for a:=1 to maxSections do begin if allInfo^[seed,a,9,1]<>'N' then begin place(seed,a,placed); if (placed) then begin blackbox(seed+1); unplace(seed,a); end; {if} end; {if allInfo} end; {for a} end; {if seed} end; {procedure blackbox} begin {main} new(allInfo); new(fieldsize); new(intInfo); new(timetable); new(placed); StrCopy(WindowTitle, 'Timetable Organizer v1.0'); StrCopy(InactiveTitle, 'Timetable Organizer v1.0'); ScreenSize.X:=80; ScreenSize.Y:=41; for i:=1 to maxClasses do begin for j:=1 to maxSections do begin allInfo^[i,j,9,1]:='N'; end; end; filecounter:=47; numClasses:=0; repeat writeln; writeln('Do you want to enter more courses?'); readln(ui); if not( (ui='Y') or (ui='y') or (ui='N') or (ui='n') ) then begin writeln('Enter either ''Y'' or ''N''.'); writeln; end else begin if (ui='Y') or (ui='y') then begin numClasses:=numClasses+1; userEntry(numClasses); end; end; until (ui='N') or (ui='n'); if numClasses>0 then begin convert; initializeTimeTable; blackbox(1); end; writeln; writeln('The program is now done proccesing all possible timetables.'); writeln; writeln; write('-------------------------------------------------------------------'); writeln('-------------'); writeln; writeln('Thank you for using Timetable Organzer v1.0. If you found this software useful,'); writeln('please email the author with your comments or suggestions at:'); writeln; writeln(' mbudd@gpu.srv.ualberta.ca'); writeln; writeln; writeln(' Written by Matthew Budd - Copyright 1997'); writeln; end. {main}