home *** CD-ROM | disk | FTP | other *** search
- Program NerdBowl; {written by Kevin Hellman for A.P. Final Exam}
- { This is an unfinished program for those who want to create any type
- of soccer game. Hopefully you can get an idea from it. This program
- was orginally given as a final exam problem for Homestead advanced
- placement computer science. Every year the advanced placement class
- plays the Computer Science II class soccer- THE NERDBOWL. The assignment
- was to create a nerdbowl program. Feel free to use any of my code
- for anything- but if you do a piece of E-Mail would be nice. }
- USES CRT;
- Type
- it = record
- x,y,xv,yv:integer;
- end;
-
- Player = record {this is a user defined record}
- Name:string[20]; {this user defined type can be printed}
- Rating: set of (Sh_t,Bad,OK,Good,Great); {this user defined
- type/ SET can not be printed}
- Endurance:integer;
- Injurys :integer;
- Ability :integer;
- Goals :integer;
- AP :integer;
- End;
-
- Linkedplayerlist =record
- Person:player;
- Nextperson:^player;
- end;
- Var
- APCSTEAM : array[1..20] of Player;{these are two parallel arrays}
- CSIITEAM : array[1..20] of player;
- APCSPlayers:integer;
- CSIIPlayers:integer;
- SortedLists:Array[1..40,1..5] of player;
- PlayerList:array[1..40] of LinkedPlayerlist;
- APCSSCORE:integer;
- CSIISCORE:integer;
- TeamLoaded:boolean;
- Screen :array[1..80,1..25] of char;
- Ball:it;
-
- Procedure Initialize;
- begin
- APCSPLAYERS:=0;
- CSIIPLAYERS:=0;
- APCSSCORE:=0;
- CSIISCORE:=0;
- end;
-
- Procedure ReScreen;
- var
- x,y:integer;
- begin
- for x:=1 to 80 do for y:=1 to 25 do Screen[x,y]:=' ';
- for X:=1 to 80 do screen[X,1]:='=';
- for X:=1 to 80 do screen[X,16]:='=';
- For y:=1 to 16 do screen[1,y]:='║';
- For y:=1 to 16 do screen[80,y]:='║';
- for y:=6 to 10 do Screen[2,y]:='[';
- for y:=6 to 10 do Screen[79,y]:=']';
- end;
-
-
- Procedure DumpScreen;
- var
- x,y:integer;
- begin
- clrscr;
- for y:=1 to 23 do for x:=1 to 80 do write(screen[x,y]);
- WRITELN('AP:',apcsscore,' CSII:',csiiscore);
- end;
-
- Procedure Help;
- var
- c:integer;
- begin
- For c:=1 to 25 do writeln;
- WRITELN(' ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌NERD BOWL▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌');
- WRITELN;
- WRITELN('THIS IS A NERD BOWL SIMULATION CREATED BY KEVIN HELLMAN ON');
- WRITELN('5/31/92 FOR HIS APCS FINAL EXAM. ENJOY.................. ');
- WRITELN('KEYS');
- WRITELN('ARROW KEYS ARE FOR MOVEMENT');
- WRITELN('+ KICKS THE BALL');
- WRITELN('- PASSES THE BALL');
- WRITELN('* VIOLENCE BUTTON');
- READLN;
- end;
-
- Procedure AddAPPlayer;
- begin
- APCSPLAYERS:=APCSPLAYERS+1;
- writeln;
- Write('Name:');
- Readln(APCSTEAM[APCSPLAYERS].NAME);
- Write('Endurance:');
- Readln(APCSTEAM[APCSPLAYERS].Endurance);
- Write('Ability:');
- Readln(APCSTEAM[APCSPLAYERS].Ability);
- Write('Goals:');
- Readln(APCSTEAM[APCSPLAYERS].Goals);
- APCSTEAM[APCSPLAYERS].AP:=1;
- end;
-
- Procedure AddCSPlayer;
- begin
- CSIIPLAYERS:=CSIIPLAYERS+1;
- writeln;
- Write('Name:');
- Readln(CSIITEAM[CSIIPLAYERS].NAME);
- Write('Endurance:');
- Readln(CSIITEAM[CSIIPLAYERS].Endurance);
- Write('Ability:');
- Readln(CSIITEAM[CSIIPLAYERS].Ability);
- Write('Goals:');
- Readln(CSIITEAM[CSIIPLAYERS].Goals);
- CSIITEAM[APCSPLAYERS].AP:=0;
- end;
-
- Procedure EditDatabase;
- var
- temp:integer;
- Begin
- FOR temp:=1 to 25 do Writeln; {fixed repetition loop}
- WRITELN(' ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌Edit Data Base Menu▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌');
- Writeln(' [1]....................Add APCS Player');
- Writeln(' [2]....................Add CSII Player');
- Writeln(' [3]....................Return ');
- Write('Please enter a choice [1..3]:');
- Readln(temp);
- Case temp of {Here is a case statement}
- 1: AddAPPlayer;
- 2: AddCSPLAYER;
- 3: exit;
- else
- editDatabase;
- end;
- Editdatabase
- end;
-
- Procedure LoadDatabase;
- var
- F:text;
- Temp:integer;
- begin
- Assign(F,'Players.TXT');
- APCSPLAYERS:=0;
- CSIIPLAYERS:=0;
- Reset(F);
- Repeat
- Readln(F,temp);
- if temp=1 then
- begin
- APCSPLAYERS:=APCSPLAYERS+1;
- Readln(F,APCSTEAM[APCSPLAYERS].NAME);
- Readln(F,APCSTEAM[APCSPLAYERS].Endurance);
- Readln(F,APCSTEAM[APCSPLAYERS].Ability);
- Readln(F,APCSTEAM[APCSPLAYERS].Goals);
- APCSTEAM[APCSPLAYERS].AP:=1;
- end
- else
- begin
- CSIIPLAYERS:=CSIIPLAYERS+1;
- Readln(F,CSIITEAM[CSIIPLAYERS].NAME);
- Readln(F,CSIITEAM[CSIIPLAYERS].Endurance);
- Readln(F,CSIITEAM[CSIIPLAYERS].Ability);
- Readln(F,CSIITEAM[CSIIPLAYERS].Goals);
- CSIITEAM[CSIIPLAYERS].AP:=0;
- end;
- until eof(F);
- CLOSE(F);
- end;
-
- Procedure SaveDatabase;
- var
- F:text;
- Temp:integer;
- begin
- Assign(F,'Players.TXT');
- Rewrite(F);
- For temp:=1 to APCSPLAYERS do
- begin
- Writeln(F,1);
- Writeln(F,APCSTEAM[temp].NAME);
- Writeln(F,APCSTEAM[temp].Endurance);
- Writeln(F,APCSTEAM[temp].Ability);
- Writeln(F,APCSTEAM[temp].Goals);
- end;
-
- For temp:=1 to CSIIPLAYERS do
- begin
- Writeln(F,0);
- Writeln(F,CSIITEAM[temp].NAME);
- Writeln(F,CSIITEAM[temp].Endurance);
- Writeln(F,CSIITEAM[temp].Ability);
- Writeln(F,CSIITEAM[temp].Goals);
- end;
- Close(F);
- end;
-
- Procedure SeeAP;
- var
- I,J:integer;
- Low,High:integer;
- SLow:string;
- begin
- Low:=1;
- For I:=1 to APCSplayers do
- if APCSTEAM[I].NAME<APCSTEAM[LOW].NAME then
- LOW:=I;
- High:=low;
- playerlist[1].Person:=apcsteam[LOW];
-
- For J:=2 to Apcsplayers do {SORTS THE PLAYERS}
- begin
- Slow:='ZZZZZ';
- For I:=1 to apcsplayers do
- if (APCSTEAM[I].NAME<Slow) and (APCSTEAM[I].NAME >APCSTEAM[HIGH].NAME) then
- begin
- LOW:=I;
- Slow:=APCSTEAM[I].NAME;
- end;
- High:=low;
- playerlist[J].Person:=apcsteam[LOW];
- end;
-
- WRITELN;
- WRITELN;
- WRITELN('NAME Endurance Ability Goals');
- Writeln('---- --------- ------- -----');
- For I:=1 to Apcsplayers do
- begin
- WRITE(playerlist[I].PERSON.NAME);
- For J:=1 to 20-length(playerlist[I].PERSON.NAME) do
- write(' ');
- WRITE(playerlist[I].PERSON.ENDURANCE,' ');
- WRITE(playerlist[I].PERSON.Ability, ' ');
- WRITEln(playerlist[I].PERSON.Goals);
- end;
- READLN;
- end;
-
- Procedure SeeCS;
- var
- I,J:integer;
- Low,High:integer;
- SLow:string;
- begin
- Low:=1;
- For I:=1 to CSIIplayers do
- if CSIITEAM[I].NAME<CSIITEAM[LOW].NAME then
- LOW:=I;
- High:=low;
- playerlist[1].Person:=csIIteam[LOW];
-
- For J:=2 to csiiplayers do {SORTS THE PLAYERS}
- begin
- Slow:='ZZZZZ';
- For I:=1 to csiiplayers do
- if (CSiiTEAM[I].NAME<Slow) and (CSiiTEAM[I].NAME >CSiiTEAM[HIGH].NAME) then
- begin
- LOW:=I;
- Slow:=CSIITEAM[I].NAME;
- end;
- High:=low;
- playerlist[J].Person:=csiiteam[LOW];
- end;
-
- WRITELN;
- WRITELN;
- WRITELN('NAME Endurance Ability Goals');
- Writeln('---- --------- ------- -----');
- For I:=1 to csiiplayers do
- begin
- WRITE(playerlist[I].PERSON.NAME);
- For J:=1 to 20-length(playerlist[I].PERSON.NAME) do
- write(' ');
- WRITE(playerlist[I].PERSON.ENDURANCE,' ');
- WRITE(playerlist[I].PERSON.Ability, ' ');
- WRITEln(playerlist[I].PERSON.Goals);
- end;
- READLN;
- end;
-
- Procedure Seeboth;
- var
- X:integer;
- I,J:integer;
- Low,High:integer;
- SLow:string;
- begin
- For x:=1 to apcsplayers do
- sortedlists[X,1]:=APCSTEAM[X];
- For X:=1 to csIIplayers do
- sortedlists[apcsplayers+X,1]:=CSIITEAM[X];
- x:=APCSPLAYERS+CSIIPLAYERS;
- Low:=1;
- For I:=1 to X do
- if SORTEDLISTs[I,1].NAME<SORTEDLISTs[LOW,1].NAME then
- LOW:=I;
- High:=low;
- playerlist[1].Person:=sortedlists[LOW,1];
-
- For J:=2 to X do {SORTS THE PLAYERS}
- begin
- Slow:='ZZZZZ';
- For I:=1 to X do
- if (Sortedlists[I,1].NAME<Slow) and (Sortedlists[I,1].NAME >Sortedlists[HIGH,1].NAME) then
- begin
- LOW:=I;
- Slow:=SORTEDLISTs[I,1].NAME;
- end;
- High:=low;
- playerlist[J].Person:=SORTEDLISTs[LOW,1];
- end;
-
- WRITELN;
- WRITELN;
- WRITELN('NAME Endurance Ability Goals');
- Writeln('---- --------- ------- -----');
- For I:=1 to X do
- begin
- WRITE(playerlist[I].PERSON.NAME);
- For J:=1 to 20-length(playerlist[I].PERSON.NAME) do
- write(' ');
- WRITE(playerlist[I].PERSON.ENDURANCE,' ');
- WRITE(playerlist[I].PERSON.Ability, ' ');
- WRITEln(playerlist[I].PERSON.Goals);
- end;
- READLN;
- end;
-
- Procedure DispStatistics;
- var
- temp:integer;
- begin
- FOR temp:=1 to 25 do Writeln; {fixed repetition loop}
- WRITELN(' ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌Stats Menu▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌');
- Writeln;
- Writeln(' [1]....................See APCS Team');
- Writeln(' [2]....................See CSII Team');
- Writeln(' [3]....................See Both Teams ');
- Writeln(' [4]....................HELP');
- Writeln(' [5]....................Return to Main Menu');
- Writeln;
- Write('Please enter a choice [1..6]:');
- Readln(temp);
- Case temp of {Here is a case statement}
- 1: SeeAP;
- 2: SeeCS;
- 3: SeeBoth;
- 4: Help;
- 5: exit;
- else
- DispStatistics;;
- end;
- DispStatistics;
- end;
-
-
- Procedure DataBaseMenu; {procedure with no parameters}
- var
- Temp:integer;
- begin
- FOR temp:=1 to 25 do Writeln; {fixed repetition loop}
- WRITELN(' ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌Data Base Menu▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌');
- Writeln;
- Writeln(' [1]....................Edit Database');
- Writeln(' [2]....................Load Database');
- Writeln(' [3]....................Save Database ');
- Writeln(' [4]....................Display Statistics');
- Writeln(' [5]....................HELP');
- Writeln(' [6]....................Return to Main Menu');
- Writeln;
- Write('Please enter a choice [1..6]:');
- Readln(temp);
- Case temp of {Here is a case statement}
- 1: EditDatabase;
- 2: LoadDatabase;
- 3: SaveDatabase;
- 4: DispStatistics;
- 5: Help;
- 6: exit;
- else
- DatabaseMenu;
- end;
- end;
-
- Procedure GameMenu;
- begin
- end;
-
- Procedure SimGame;
- begin
- end;
-
- Procedure WatchGame;
- TYPE
- PLACE = RECORD
- X,Y:INTEGER;
- END;
- VAR
- APGUYS,CSGUYS:INTEGER;
- APPOSITIONS: ARRAY[1..20] OF PLACE;
- CSPOSITIONS: ARRAY[1..20] OF PLACE;
-
- PROCEDURE INITPOSITIONS;
- VAR
- c:INTEGER;
- BEGIN
- FOR C:=1 TO APGUYS DO
- BEGIN
- APPOSITIONS[C].X:=38;
- APPOSITIONS[C].Y:=C+1;
- END;
- FOR C:=1 TO CSGUYS DO
- BEGIN
- CSPOSITIONS[C].X:=41;
- CSPOSITIONS[C].Y:=c+1;
- END;
- END;
-
- Procedure Apgoal;
- begin
- apcsscore:=apcsscore+1;
- clrscr;
- WRITELN('AP SCORES !');
- Delay(1000);
- ball.X:=30;
- ball.Y:=8;
- initpositions;
- end;
-
- Procedure CSgoal;
- begin
- csIIscore:=csIIscore+1;
- clrscr;
- WRITELN('CS SCORES !');
- Delay(1000);
- ball.X:=70;
- ball.Y:=8;
- initpositions;
- end;
-
- Procedure MoveBall;
- begin
- Ball.X:=(Ball.X+Ball.XV);
- Ball.Y:=Ball.Y+Ball.YV;
- Ball.XV:=Ball.XV div 2;
- Ball.YV:=Ball.YV div 2;
- if (Ball.X>=80) or (Ball.X<=1) then ball.x:=40;
- if (Ball.Y>=16) or (Ball.Y<=1) then ball.Y:=8;
- if screen[ball.x,ball.y]='[' then Apgoal;
- if screen[ball.x,ball.y]=']' then CSgoal;
- screen[ball.x,ball.y]:='.';
- end;
-
- Procedure Placemen;
- var
- c:integer;
- begin
- For c:=1 to apguys do
- screen[APPOSITIONS[C].X,APPOSITIONS[C].Y]:=chr(1);
- For c:=1 to csguys do
- screen[CSPOSITIONS[C].X,CSPOSITIONS[C].Y]:=chr(2);
- end;
-
- Procedure APMOVE;
- var
- c:integer;
- ox,oy:integer;
- begin
- for c:=1 to APguys do
- begin
- ox:=appositions[c].X;
- oy:=appositions[c].Y;
- if ball.X+1<appositions[c].X then
- appositions[c].X:=appositions[c].X-1-random((appositions[c].X- ball.X)div 2);
- if ball.Y+1<appositions[c].Y then
- appositions[c].Y:=appositions[c].Y-1-random((appositions[c].Y- ball.Y)div 2);
- if ball.X-1>appositions[c].X then
- appositions[c].X:=appositions[c].X+1+random(( ball.X - appositions[c].X) div 2);
- if ball.Y-1>appositions[c].Y then
- appositions[c].Y:=appositions[c].Y+1+random(( ball.Y - appositions[c].Y) div 2);
- if (ABS(Ball.X-appositions[c].X)<2) and (abs(ball.y-appositions[c].y)<2)
- then
- begin
- Ball.XV:=Ball.XV-random(4);
- Ball.YV:=Ball.YV+random(4)-2;
- if (Ball.X>=80) or (Ball.X<=1) then ball.x:=40;
- if (Ball.Y>=16) or (Ball.Y<=1) then ball.Y:=8;
- end;
-
- if screen[appositions[c].x,appositions[c].y]<>' ' then
- begin
- appositions[c].X:=ox;
- appositions[c].Y:=oy;
- end;
- placemen;
- end;
- end;
-
- Procedure CSMOVE;
- var
- c:integer;
- ox,oy:integer;
- begin
- for c:=1 to CSguys do
- begin
- ox:=cspositions[c].X;
- oy:=cspositions[c].Y;
- if ball.X+1<cspositions[c].X then
- cspositions[c].X:=cspositions[c].X-1-random((cspositions[c].X- ball.X)div 2);
- if ball.Y+1<cspositions[c].Y then
- cspositions[c].Y:=cspositions[c].Y-1-random((cspositions[c].Y- ball.Y)div 2);
- if ball.X-1>cspositions[c].X then
- cspositions[c].X:=cspositions[c].X+1+random((ball.X - cspositions[c].X) div 2);
- if ball.Y-1>cspositions[c].Y then
- cspositions[c].Y:=cspositions[c].Y+1+random((ball.Y - cspositions[c].Y) div 2);
- if (ABS(Ball.X-cspositions[c].X)<2) and (abs(ball.y-cspositions[c].y)<2)
- then
- begin
- Ball.XV:=Ball.XV-random(4);
- Ball.YV:=Ball.YV+random(4)-2;
- if (Ball.X>=80) or (Ball.X<=1) then ball.x:=40;
- if (Ball.Y>=16) or (Ball.Y<=1) then ball.Y:=8;
- end;
- if screen[cspositions[c].x,cspositions[c].y]<>' ' then
- begin
- cspositions[c].X:=ox;
- cspositions[c].Y:=oy;
- placemen;
- end;
- end;
- end;
-
- Begin
- Ball.X:=40;
- Ball.Y:=5;
- Ball.XV:=0;
- Ball.YV:=0;
- WRITELN('HOW MANY PEOPLE FROM AP ARE PLAYING ?');
- READLN(APGUYS);
- WRITELN('HOW MANY PEOPLE FROM CS2 ARE PLAYING ?');
- READLN(CSGUYS);
- INITPOSITIONS;
- Rescreen;
- placemen;
- MoveBall;
- Dumpscreen;
- Repeat
- apmove;
- csmove;
- Rescreen;
- placemen;
- MoveBall;
- Dumpscreen;
- Delay(1000);
- until keypressed;
- end;
-
- Procedure PLayGame;
- TYPE
- PLACE = RECORD
- X,Y:INTEGER;
- END;
- VAR
- APGUYS,CSGUYS:INTEGER;
- APPOSITIONS: ARRAY[1..20] OF PLACE;
- CSPOSITIONS: ARRAY[1..20] OF PLACE;
-
- PROCEDURE INITPOSITIONS;
- VAR
- c:INTEGER;
- BEGIN
- FOR C:=1 TO APGUYS DO
- BEGIN
- APPOSITIONS[C].X:=38;
- APPOSITIONS[C].Y:=C+1;
- END;
- FOR C:=1 TO CSGUYS DO
- BEGIN
- CSPOSITIONS[C].X:=41;
- CSPOSITIONS[C].Y:=c+1;
- END;
- END;
-
- Procedure Apgoal;
- begin
- apcsscore:=apcsscore+1;
- clrscr;
- WRITELN('AP SCORES !');
- Delay(1000);
- ball.X:=30;
- ball.Y:=8;
- initpositions;
- end;
-
- Procedure CSgoal;
- begin
- csIIscore:=csIIscore+1;
- clrscr;
- WRITELN('CS SCORES !');
- Delay(1000);
- ball.X:=70;
- ball.Y:=8;
- initpositions;
- end;
-
- Procedure MoveBall;
- begin
- Ball.X:=(Ball.X+Ball.XV);
- Ball.Y:=Ball.Y+Ball.YV;
- Ball.XV:=Ball.XV div 2;
- Ball.YV:=Ball.YV div 2;
- if (Ball.X>=80) or (Ball.X<=1) then ball.x:=40;
- if (Ball.Y>=16) or (Ball.Y<=1) then ball.Y:=8;
- if screen[ball.x,ball.y]='[' then Apgoal;
- if screen[ball.x,ball.y]=']' then CSgoal;
- screen[ball.x,ball.y]:='.';
- end;
-
- Procedure Placemen;
- var
- c:integer;
- begin
- screen[appositions[1].X,appositions[1].y]:='I';
- For c:=2 to apguys do
- screen[APPOSITIONS[C].X,APPOSITIONS[C].Y]:=chr(1);
- For c:=1 to csguys do
- screen[CSPOSITIONS[C].X,CSPOSITIONS[C].Y]:=chr(2);
- end;
-
- Procedure APMOVE;
- var
- c:integer;
- ox,oy:integer;
- begin
- for c:=2 to APguys do
- begin
- ox:=appositions[c].X;
- oy:=appositions[c].Y;
- if ball.X+1<appositions[c].X then
- appositions[c].X:=appositions[c].X-1-random((appositions[c].X- ball.X)div 2);
- if ball.Y+1<appositions[c].Y then
- appositions[c].Y:=appositions[c].Y-1-random((appositions[c].Y- ball.Y)div 2);
- if ball.X-1>appositions[c].X then
- appositions[c].X:=appositions[c].X+1+random(( ball.X - appositions[c].X) div 2);
- if ball.Y-1>appositions[c].Y then
- appositions[c].Y:=appositions[c].Y+1+random(( ball.Y - appositions[c].Y) div 2);
- if (ABS(Ball.X-appositions[c].X)<2) and (abs(ball.y-appositions[c].y)<2)
- then
- begin
- Ball.XV:=Ball.XV-random(4);
- Ball.YV:=Ball.YV+random(4)-2;
- if (Ball.X>=80) or (Ball.X<=1) then ball.x:=40;
- if (Ball.Y>=16) or (Ball.Y<=1) then ball.Y:=8;
- end;
-
- if screen[appositions[c].x,appositions[c].y]<>' ' then
- begin
- appositions[c].X:=ox;
- appositions[c].Y:=oy;
- end;
- placemen;
- end;
- end;
-
- Procedure CSMOVE;
- var
- c:integer;
- ox,oy:integer;
- begin
- for c:=1 to CSguys do
- begin
- ox:=cspositions[c].X;
- oy:=cspositions[c].Y;
- if ball.X+1<cspositions[c].X then
- cspositions[c].X:=cspositions[c].X-1-random((cspositions[c].X- ball.X)div 2);
- if ball.Y+1<cspositions[c].Y then
- cspositions[c].Y:=cspositions[c].Y-1-random((cspositions[c].Y- ball.Y)div 2);
- if ball.X-1>cspositions[c].X then
- cspositions[c].X:=cspositions[c].X+1+random((ball.X - cspositions[c].X) div 2);
- if ball.Y-1>cspositions[c].Y then
- cspositions[c].Y:=cspositions[c].Y+1+random((ball.Y - cspositions[c].Y) div 2);
- if (ABS(Ball.X-cspositions[c].X)<2) and (abs(ball.y-cspositions[c].y)<2)
- then
- begin
- Ball.XV:=Ball.XV-random(4);
- Ball.YV:=Ball.YV+random(4)-2;
- if (Ball.X>=80) or (Ball.X<=1) then ball.x:=40;
- if (Ball.Y>=16) or (Ball.Y<=1) then ball.Y:=8;
- end;
- if screen[cspositions[c].x,cspositions[c].y]<>' ' then
- begin
- cspositions[c].X:=ox;
- cspositions[c].Y:=oy;
- placemen;
- end;
- end;
- end;
-
- Procedure Handlebutton;
- var
- ch:char;
- ox,oy:integer;
- begin
- ch:=readkey;
- ox:=appositions[1].X;
- oy:=appositions[1].Y;
- if (ch='I') and (appositions[1].y>3) then appositions[1].Y:=appositions[1].Y-2;
- if (ch='K') and (appositions[1].y<14) then appositions[1].Y:=appositions[1].Y+2;
- if (ch='J') and (appositions[1].X>3) then appositions[1].X:=appositions[1].X-2;
- if (ch='L') and (appositions[1].X<14) then appositions[1].X:=appositions[1].X+2;
- if screen[cspositions[1].x,cspositions[1].y]<>' ' then
- begin
- cspositions[1].X:=ox;
- cspositions[1].Y:=oy;
- placemen;
- end;
- end;
-
- Begin
- Ball.X:=40;
- Ball.Y:=5;
- Ball.XV:=0;
- Ball.YV:=0;
- WRITELN('HOW MANY PEOPLE FROM AP ARE PLAYING ?');
- READLN(APGUYS);
- WRITELN('HOW MANY PEOPLE FROM CS2 ARE PLAYING ?');
- READLN(CSGUYS);
- INITPOSITIONS;
- Rescreen;
- placemen;
- MoveBall;
- Dumpscreen;
- Repeat
- if keypressed then handlebutton;
- apmove;
- csmove;
- Rescreen;
- placemen;
- MoveBall;
- Dumpscreen;
- Delay(1000);
- until apcsscore+csiiscore>10;
- end;
-
-
- Procedure MainMenu; {procedure with no parameters}
- var
- Temp:integer;
- begin
- FOR temp:=1 to 25 do Writeln; {fixed repetition loop}
- WRITELN(' ▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌Main Menu▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌▌');
- Writeln;
- Writeln(' [1]....................NerdBowl DataBase');
- Writeln(' [2]....................Watch Simulated Game');
- Writeln(' [3]....................HELP');
- Writeln(' [4]....................Quit');
- Writeln(' [5]....................Play Game');
- Writeln;
- Write('Please enter a choice [1..6]:');
- Readln(temp);
- Case temp of {Here is a case statement}
- 1: DatabaseMenu;
- 2: WatchGame;
- 3: Help;
- 4: halt;
- 5: playgame;
- else
- MainMenu;
- end;
- Mainmenu
- end;
-
- begin
- Initialize;
- Mainmenu;
- end.
-