Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program paint;
- uses crt;
- type int = integer;
- var
- kt : boolean;
- k : char;
- co : int;
- s : string;
- bl : array[1..80,1..25]of int;
- f : text;
- procedure change(var k:char);
- var i,c:int;
- begin
- val(k,i,c);
- co:=i;
- textcolor(co);
- textbackground(co);
- end;
- procedure movement(var i,j:int);
- var io,jo:int;
- begin
- k:=readkey;
- case k of
- 'M' : if(j<80) then begin
- textcolor(co);
- gotoxy(j,i); write('>');
- j:=j+1;
- textcolor(black);
- gotoxy(j,i); write('>');
- end;
- 'K' : if (j>1) then begin
- textcolor(co);
- gotoxy(j,i); write('<');
- textcolor(black);
- j:=j-1;
- gotoxy(j,i); write('<');
- end;
- 'H' : if (i>1) then begin
- textcolor(co);
- gotoxy(j,i); write('^');
- i:=i-1;
- textcolor(black);
- gotoxy(j,i); write('^');
- end;
- 'P' : if (i<24) then begin
- textcolor(co);
- gotoxy(j,i); write('V');
- textcolor(black);
- i:=i+1;
- gotoxy(j,i); write('V');
- end;
- 'c' : begin
- inc(co); kt:=true;
- textcolor(co);
- textbackground(co);
- if co=8 then begin
- co:=1;
- textcolor(co+blink);
- textbackground(co+blink);
- end;
- end;
- '1' :change(k); '2' :change(k);
- '3' :change(k); '4' :change(k);
- '5' :change(k); '6' :change(k);
- '7' :change(k);
- 't' :begin
- textcolor(black); gotoxy(54,25); write('remember to type space 1st');
- gotoxy(j,i);
- readln(s); gotoxy(54,25); clreol;
- gotoxy(j,i);
- textcolor(co);
- end;
- {text}
- 'e' :begin
- co:=7;
- textcolor(co);
- textbackground(co); kt:=false;
- end;
- 'a' :begin
- co:=0;
- repeat
- inc(co);
- textcolor(co);
- textbackground(co);
- for io:=1 to 25 do for jo:=1 to 80 do begin write('C'); clrscr; end;
- until co=7;
- textcolor(black);
- gotoxy(1,25); write('COLOR : ');
- gotoxy(1,1); write('Y'); i:=1; j:=1;
- end;
- end;
- end;
- procedure play;
- var i,j,dem:int;
- begin
- fillchar(bl,sizeof(bl),0);
- textbackground(7); textcolor(7);
- for i:=1 to 25 do for j:=1 to 80 do write('C');
- kt:=false;
- textcolor(black);
- textbackground(white);
- gotoxy(1,1); write('Y'); i:=1; j:=i; co:=7;
- textcolor(black);
- gotoxy(1,25); write('COLOR : ');
- dem:=0; kt:=false;
- while k<>#27 do
- begin
- movement(i,j); textcolor(co);
- textcolor(co);
- if kt then
- begin {Village_1.dat}
- bl[j,i]:=co;
- end else bl[j,i]:=0;
- gotoxy(9,25); write('0 ');
- textcolor(black); textbackground(7);
- gotoxy(25,25); clreol;
- gotoxy(25,25); write('position: ',j,'_',i,' Color code=',bl[j,i],' ',kt);
- textcolor(co); textbackground(co);
- end;
- assign(f,'Line.out'); rewrite(f); {ho tro cho captain moving}
- textcolor(4); textbackground(4);
- for i:=1 to 80 do
- for j:=1 to 25 do if bl[i,j]<>0 then
- begin
- gotoxy(i,j); write('C');
- writeln(f,i,' ',j,' ',bl[i,j]);
- end;
- textcolor(black); textbackground(7);
- gotoxy(72,25); write('Checked');
- readln;
- close(f);
- end;
- procedure head;
- begin
- end;
- begin
- clrscr;
- play;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement