USES graph,crt,my_unit; const n=16; Type smaylo=array [1..n,1..n] of byte; Var z:smaylo; s:string; Procedure initm; var x,y:word; lb,mb,rb:boolean; b,err:byte; begin initmouse(b,err); setmousexy(0,0); mouseon; end; Function strtobyte(s:string):byte; var Code: Integer; i:byte; begin Val(ParamStr(1), I, Code); if code = 0 then strtobyte:=i; end; Procedure initgr; var gd,gm:integer; begin gd:=detect; initgraph(gd,gm,''); SetTextStyle(smallfont, HorizDir, 6); setcolor(11); outtext('0,11-prozrachniy cvet') end; Procedure loadfile; var f:text; i,j:byte; a,b:char; begin write ('input filename plz:'); readln(s); assign(f,s); reset(f); for i:= 1 to 16 do for j:=1 to 16 do begin read(f,a,b); z[i,j]:=strtobyte(a+b); end; close(f); end; Procedure theend; label 1; var f:text; s:string; i,j,c:byte; begin mouseoff; 1: assign(f,s); rewrite(f) ; for i:= 1 to n do begin for j:= 1 to n do begin c:=getpixel(+1+j*20,+1+i*20); if c=0 then c:=11; write(f,'',c,' '); end; writeln(f,''); end; close(f); closegraph; halt; end; var xl,yl,x,y:word; lb,rb,tb:boolean; i,j:byte; begin loadfile; xl:=25; yl:=25; initgr; initm; For i := 1 to n+1 do {goriz} line(i*20,20,i*20,340); For i := 1 to n+1 do {vert} line(20,i*20,340,i*20); For i := 1 to n-1 do if i <> 11 then begin outtextxy(350,i*20,inttostr(i)); outtextxy(370,i*20,chr(i+ord('a'))); end; mouseoff; For I := 1 to n do {goriz} For J := 1 to n do {vert} begin setfillstyle(1,z[i,j]); floodfill(i*20+5,j*20+5,11); end; mouseon; setmousexy(xl,yl); repeat if keypressed then i:=ord(readkey); if i-97<>11 then begin setcolor(i-97); setfillstyle(1,i-97); end; getmousexy(x,y,lb,rb,tb); if (x<25) or (x>335) or (y<25) or (y>335) then setmousexy(xl,yl); xl:=x; yl:=y; if lb=true then begin mouseoff; floodfill(x,y,11); mouseon; end; if rb=true then begin mouseoff; setfillstyle(1,0); floodfill(x,y,11); mouseon; end; until i=27; theend end.