program move; uses crt, dos, graph; var i, x, y, l, x1, y1, c, m, pts, sek, Origmode, x2, y2, y3, x8, y8, size, co, u1, u2, y7: integer; s: string; fail1, fail2, fail3, fail4, fail5:text; p: array[1..23] of string; ho, mi, se, hund, ho1, mi1, se1, hund1, color: word; {$I graf.pas} {$I kujundus.pas} {$I kujund.pas} {$I tim2.pas} {$I kuju.pas} {$I g2.pas} {$I g3.pas} {$I g6.pas} procedure znak (kx,ky:integer); begin gotoxy(kx,ky); writeln('*'); end; Procedure kursor_tagasi; BEGIN asm mov ah,1 mov ch,6 mov cl,7 int 10h end END; Procedure kaota_kursor; BEGIN asm mov ah,1 mov ch,1 mov cl,0 int 10h end END; label 1,2,3,4,5,6,7,8,9,10,11,12,13,14; begin kaota_kursor; open; 11: Origmode:=lastmode; textmode(CO40); kaota_kursor; gotoxy(19,9); textcolor(blue); write('MENU'); gotoxy(14,10); textcolor(2); write('S-start game'); gotoxy(14,11); textcolor(8); write('K-define keys'); gotoxy(14,12); textcolor(4); write('Q-quit game'); kuju; s:=readkey; if (s='s') then begin gotoxy(14,10); textcolor(10); write('S-start game');delay(500); textmode(Origmode); goto 10; end; if (s='k') then begin gotoxy(14,11); textcolor(7); write('K-define keys');delay(500); clrscr; 12:gotoxy(17,8);textcolor(10); writeln('Keys');textcolor(11); gotoxy(15,9); writeln(' -up');gotoxy(15,10); writeln('® -left');gotoxy(15,11); writeln('¯ -right');gotoxy(15,12); writeln(' -down');gotoxy(7,13); textcolor(13); write('Press Esc to return to Menu'); s:=readkey; if s=chr(27) then goto 11; if s<>chr(27) then goto 12; end; if (s='q') then begin gotoxy(14,12); textcolor(12); write('Q-quit game'); delay(500); textmode(CO80); goto 13; end; if (s<>'s') or (s<>'k') or (s<>'q') then goto 11; 10: textmode(CO80); kaota_kursor; c:=0; pts:=0; sek:=1800; textcolor(white); gotoxy(52,15); writeln('Points:',pts:5); gotoxy(1,1); 6:textcolor(2); textbackground(black); c:=c+1; case c of 1:begin assign(fail1,'level1.txt'); reset(fail1); for l:=1 to 23 do begin readln(fail1,p[l]); for m:=2 to 43 do begin if p[l,m]='' then textcolor(red); if p[l,m]='' then textcolor(14+blink); gotoxy(m,l); writeln(p[l,m]); textcolor(green); end; end; close(fail1); end; 2: begin clrscr; textcolor(white); gotoxy(52,15); write('Points:',pts); textcolor(11); gotoxy(1,1); assign(fail2,'level2.txt'); reset(fail2); for l:=1 to 23 do begin readln(fail2,p[l]); for m:=2 to 43 do begin if p[l,m]='' then textcolor(red); if p[l,m]='' then textcolor(14+blink); gotoxy(m,l); writeln(p[l,m]); textcolor(14); end; end; close(fail2); end; 3:begin assign(fail3,'level3.txt'); reset(fail3); for l:=1 to 23 do begin readln(fail3,p[l]); for m:=2 to 43 do begin if p[l,m]='' then textcolor(red); if p[l,m]='' then textcolor(14+blink); gotoxy(m,l); writeln(p[l,m]); textcolor(6); end; end; close(fail3); end; 4:begin assign(fail4,'level4.txt'); reset(fail4); for l:=1 to 23 do begin readln(fail4,p[l]); for m:=2 to 43 do begin if p[l,m]='' then textcolor(red); if p[l,m]='' then textcolor(14+blink); gotoxy(m,l); writeln(p[l,m]); textcolor(1); end; end; close(fail4); end; 5:begin assign(fail5,'level5.txt'); reset(fail5); for l:=1 to 23 do begin readln(fail5,p[l]); for m:=2 to 43 do begin if p[l,m]='' then textcolor(red); if p[l,m]='' then textcolor(14+blink); gotoxy(m,l); writeln(p[l,m]); textcolor(8); end; end; close(fail5); end; else goto 8; end; 7:kujundus; kujund; x:=3; y:=3; textcolor(white+blink); textbackground(black); 5:repeat gettime(ho,mi,se,hund); textcolor(white+blink); znak(x,y); delay(50); textcolor(black); znak(x,y); textcolor(15); gotoxy(52,15); write('Points:',pts:5); tim2; if sek=0 then goto 8; until keypressed; s:=readkey; if (s=chr(0)) or (s='n') or (s='r') or (s='p') or (s='q') or (s='s') then begin s:=ReadKey; if (s='n') then begin if c=5 then goto 5; pts:=0; sek:=1800; goto 6; end; if (s='r') then begin pts:=0; sek:=1800; c:=c-1; goto 6; end; if (s='p') then begin if c=1 then goto 5; pts:=0; sek:=1800; c:=c-2; goto 6; end; if (s='q') then goto 8; if (s='s') then goto 10; if (s='K') and (x>2) then begin x1:=x-1; y1:=y; goto 1; end; if (s='M') and (x<79) then begin x1:=x+1; y1:=y; goto 2; end; if (s='H') and (y>2) then begin y1:=y-1; x1:=x; goto 3; end; if (s='P') and (y<23) then begin y1:=y+1; x1:=x; goto 4; end; end; if (s<>chr(0)) or (s<>'n') or (s<>'r') or (s<>'p') or (s<>'q') or (s<>'s') then goto 5; 1: if (p[y1,x1]='') or (p[y1,x1]='') then begin if c=5 then begin pts:=pts+sek; goto 14; end; pts:=pts+sek; sek:=1800; goto 6; end; if p[y1,x1]='' then begin sound(392); delay(50); sound(523); delay(50); nosound; gotoxy(x1,y1); textcolor(red); textbackground(black); znak(x1,y1); textcolor(white); textbackground(black); pts:=pts+10; p[y1,x1]:=' '; goto 9; end; if p[y1,x1]='²' then begin x:=x1+1; y:=y1; textcolor(white+blink); znak(x,y); goto 5; end; 2: if (p[y1,x1]='') or (p[y1,x1]='') then begin if c=5 then begin pts:=pts+sek; goto 14; end; pts:=pts+sek; sek:=1800; goto 6; end; if p[y1,x1]='' then begin sound(392); delay(50); sound(523); delay(50); nosound; gotoxy(x1,y1); textcolor(red); textbackground(black); znak(x1,y1); textcolor(white); textbackground(black); pts:=pts+10; p[y1,x1]:=' '; goto 9; end; if p[y1,x1]='²' then begin x:=x1-1; y:=y1; textcolor(white+blink); znak(x,y); goto 5; end; 3: if (p[y1,x1]='') or (p[y1,x1]='') then begin if c=5 then begin pts:=pts+sek; goto 14; end; pts:=pts+sek; sek:=1800; goto 6; end; if p[y1,x1]='' then begin sound(392); delay(50); sound(523); delay(50); nosound; gotoxy(x1,y1); textcolor(red+blink); textbackground(black); znak(x1,y1); textcolor(white); textbackground(black); pts:=pts+10; p[y1,x1]:=' '; goto 9; end; if p[y1,x1]='²' then begin x:=x1; y:=y1+1; textcolor(white+blink); znak(x,y); goto 5; end; 4: if (p[y1,x1]='') or (p[y1,x1]='') then begin if c=5 then begin pts:=pts+sek; goto 14; end; pts:=pts+sek; sek:=1800; goto 6; end; if p[y1,x1]='' then begin sound(392); delay(50); sound(523); delay(50); nosound; gotoxy(x1,y1); textcolor(red+blink); textbackground(black); znak(x1,y1); textcolor(white); textbackground(black); pts:=pts+10; p[y1,x1]:=' '; goto 9; end; if p[y1,x1]='²' then begin x:=x1; y:=y1-1; textcolor(white+blink); znak(x,y); goto 5; end; 9:x:=x1; y:=y1; textcolor(white+blink); znak(x,y); goto 5; 14:win; textmode(CO40); kaota_kursor; textcolor(1); gotoxy(13,13); writeln('Your points:',pts); gotoxy(0,17); textcolor(4); write('You may try again to collect more points'); readkey; 8:kursor_tagasi; textmode(CO80); over; 13: end.