Program folyadek; { Sara, a javitasokat igy jeloltem: " * P: javitas (pl. elozo alapot, v mit irtam be/at) *" } { Amit me'g nem e'rtek: miert nem rajzol ki semmit - ill. hol hivnad meg a rajzolo eljarast?} uses crt,graph; const n=35; m=21; Type tomb=array [1..n,1..m] of char; Z=char; R=char; Var path:string; hol,szi:integer; kilepo,s,seged:char; svn,svcs,svl,megegyszer,kibe:boolean; ter:tomb; leut:integer; van:boolean; Procedure Szovegesre; begin CloseGraph; {lezarja a grafikus uzemmodot} RestoreCrtMode; {Visszaallitja az InitGraph meghivasa elotti kepernyokezelesi modot} end; Procedure Grafikusra; Var gd,gm : integer; hiba:integer; kilep:boolean; valasz:char; Begin kilep:=False; path :='c:\turbo7\bin'; Repeat DetectGraph(gd,gm); {detektalja a grafikus eszkozt} InitGraph(gd,gm,path); {inicializalja a grafikus rendszert} hiba:=GraphResult; If hiba<>Grok Then Begin ClrScr; GotoXY(2,2); WriteLn('A grafikus mdhoz szksges a Graph.tpu elrsi tja.'); Gotoxy(2,3); Write('Megadja az elrsi utat (i/n)? '); Repeat valasz:=ReadKey; Until (valasz='i') or (valasz='I') or (valasz='n') or (valasz='N'); If (valasz='i') or (valasz='I') Then Begin Gotoxy(2,4); Write('Az tvonal: '); ReadLn(path); End Else Begin kilep:=True; End; End Else Begin kilep:=True; End; Until kilep; End; Procedure szimnev(x,y:integer; nev:string); Begin setfillstyle(solidfill,blue); bar(x-5,y-5,x+550,y+10); setcolor(yellow); outtextxy(x+170,y,nev); End; Procedure szimter(bfx,bfy,jax,jay:integer); var i,j:integer; svki:string; Begin randomize; setfillstyle(solidfill,black); bar(bfx,bfy,jax,jay); rectangle(bfx,bfy,jax,jay); setcolor(yellow); { For i:=1 to n do Begin For j:=1 to m do Begin setcolor(yellow); If ter[i,j]=-10 Then Begin setcolor(lightred); outtextxy(15*(i)+50,15*(j)+70,'F'); End Else Begin If ter[i,j]=1 Then Begin setcolor(green); setfillstyle(solidfill,blue); circle(15*(i)+50,15*(j)+70,5); End; End; End; End;} rectangle(bfx,bfy,jax,jay); setfillstyle(solidfill,blue); End; Procedure help1; var sv:char; p:pointer; Begin GetImage(100,230,450,370,P^); Repeat setfillstyle(solidfill,blue); bar(100,230,450,370); setcolor(yellow); outtextxy(225,245,'Segtsg'); setcolor(yellow); outtextxy(225,365,'ESC: kilps'); sv:=readkey; Until sv=#27; PutImage(100,230,P^,normalput); End; Procedure normal; Begin If svn Then Begin setcolor(yellow); outtextxy(55,450,'Norml'); setcolor(lightred); outtextxy(55,450,'N'); End Else Begin setcolor(lightred); outtextxy(55,450,'Norml'); End; End; Procedure csendes; Begin setcolor(lightblue); outtextxy(120,450,'Csendes'); End; Procedure grafikonbeki; Begin setcolor(lightblue); outtextxy(190,450,'Grafikon be/ki'); End; Procedure Lepesenkent; Begin If svl Then Begin setcolor(yellow); outtextxy(315,450,'Lpsenknt'); setcolor(lightred); outtextxy(315,450,'L'); End else Begin setcolor(lightred); outtextxy(315,450,'Lpsenknt'); End; End; Procedure parameterek; Begin setcolor(lightblue); outtextxy(415,450,'Paramter'); End; Procedure kilep; Begin setcolor(yellow); outtextxy(500,450,'Kilp'); setcolor(lightred); outtextxy(500,450,'K'); End; Procedure help; Begin setcolor(yellow); outtextxy(555,450,'Help'); setcolor(lightred); outtextxy(555,450,'H'); End; Procedure menuki(bfx,bfy,jax,jay:integer); Begin bar(bfx,bfy,jax,jay); setfillstyle(solidfill,green); bar(bfx+3,bfy+5,bfx+55,jay-10); normal; csendes; grafikonbeki; lepesenkent; parameterek; kilep; help; hol:=1; End; Procedure szimido(x,y:integer); var sv:string; Begin setfillstyle(1,black); bar(x,y+10,x+100,y); szi:=szi+1; str(szi,sv); sv:='Szim id:'+sv; setcolor(lightred); outtextxy(x,y,sv); Delay(300); End; Procedure kilep1(var seged:char); Begin seged:=' '; Repeat setfillstyle(solidfill,blue); bar(50,430,600,470); setcolor(yellow); outtextxy(205,450,'Kilps Mgsem Ellrl'); setcolor(lightred); outtextxy(205,450,'K'); setcolor(lightred); outtextxy(285,450,'M'); setcolor(lightred); outtextxy(365,450,'E'); seged:=Readkey; Until (seged='k') or (seged='K') or (seged='m') or (seged='M') or (seged='E') or (seged='e'); If (seged='k') or (seged='K') Then kilepo:='v' Else Begin If (seged='e') or (seged='E') Then Begin megegyszer:=true; kilepo:='v'; End Else menuki(50,430,600,470); End; End; Procedure menu(bfx,bfy,jax,jay:integer;var hol:integer); var c:char; Begin Repeat s:=readkey; If s=#0 then begin c:=readkey; case c of #75: begin case hol of 1: Begin setfillstyle(solidfill,blue); bar(bfx,bfy,bfx+55,jay); normal; setfillstyle(solidfill,green); bar(bfx+495,bfy,bfx+540,jay-5); help; hol:=7; s:='v'; End; 7: Begin setfillstyle(solidfill,blue); bar(bfx+495,bfy,bfx+540,jay-5); help; setfillstyle(solidfill,green); bar(bfx+443,bfy,bfx+490,jay-5); kilep; hol:=6; s:='v'; End; 6: Begin setfillstyle(solidfill,blue); bar(bfx+443,bfy,bfx+490,jay-5); kilep; setfillstyle(solidfill,green); bar(bfx+260,bfy,bfx+350,jay-5); lepesenkent; hol:=4; s:='v'; End; 4: Begin setfillstyle(solidfill,blue); bar(bfx+260,bfy,bfx+350,jay-5); lepesenkent; setfillstyle(solidfill,green); bar(bfx,bfy,bfx+55,jay-5); normal; hol:=1; s:='v'; End; End; end; #77: begin case hol of 7: Begin setfillstyle(solidfill,green); bar(bfx,bfy,bfx+55,jay-5); normal; setfillstyle(solidfill,blue); bar(bfx+495,bfy,bfx+540,jay-5); help; hol:=1; s:='v'; End; 1: Begin setfillstyle(solidfill,blue); bar(bfx,bfy,bfx+55,jay); normal; setfillstyle(solidfill,green); bar(bfx+260,bfy,bfx+350,jay-5); lepesenkent; hol:=4; s:='v'; End; 4: Begin setfillstyle(solidfill,blue); bar(bfx+260,bfy,bfx+350,jay-5); lepesenkent; setfillstyle(solidfill,green); bar(bfx+443,bfy,bfx+490,jay-5); kilep; hol:=6; s:='v'; End; 6: Begin setfillstyle(solidfill,blue); bar(bfx+443,bfy,bfx+490,jay-5); kilep; setfillstyle(solidfill,green); bar(bfx+495,bfy,bfx+540,jay-5); help; hol:=7; s:='v'; End; End; end; end; End; If s=#13 Then Begin case hol of 1: Begin s:='v'; leut:=1; svn:=false; svcs:=true; svl:=true; csendes; normal; lepesenkent; End; 2: Begin s:='v'; leut:=2; svn:=true; svcs:=false; svl:=true; csendes; normal; lepesenkent; End; 3: Begin s:='v'; If leut=3 Then leut:=1 else leut:=3; End; 4: Begin s:='v'; leut:=4; kibe:=true; svn:=true; svcs:=true; svl:=false; csendes; normal; lepesenkent; End; 5: Begin {parameterno(638,70,400,250);} s:='v'; End; 6: Begin kilep1(seged); s:='v'; End; 7: Begin help1; s:='v'; End; End; End; until (s='v') or (s='V'); End; Procedure feltolt(var ter:tomb); Var i,j,x:integer; rv,zv:real; {* P: rz, rv:=? *} begin rv:=random(8); zv:=random(8); {* P: semmilyen ertekadasa nem volt *} for i:=1 to n do begin for j:=1 to m do begin x:=random(4); {* P: (volt) x:=random(3)-1 *} if x=1) and (k<=n) and (l>=1) and (l<=m) then if ter[k,l]='Z' then begin van:=true; si:=k; sj:=l; end; end; end; end; Procedure Ragvalt(var i,j:integer); var rh,rs:real; si,sj:integer; begin Szomszedkeres('Z',VAN,si,sj); if (not VAN) or (random(3)-12 Then Begin {parameter(638,70,400,250);} If leut<>3 Then {grafikon(60,260,440,375,t,n,true,true,white);} End; End; until (kilepo='V') or (kilepo='v'); Szovegesre; until not(megegyszer); End.