Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program _ ;
- Uses Crt;
- var
- _Pole1:Array [ 0..101 , 0..101 ] of byte;
- _Pole2:Array [ 0..101 , 0..101 ] of byte;
- _X,_Y,__X,__Y,_I,_J,__i:byte;
- _A:char;
- begin
- For _J:=0 to 101 do
- For _I:=0 to 50 do begin
- _Pole1[_I*2+1,_j]:=0;_Pole2[_I*2+1,_j]:=0;_Pole1[_I*2,_j]:=0;_Pole2[_I*2,_j]:=0;
- end;
- _X:=1;_Y:=1;_A:=#0;__X:=0;__Y:=0;
- while _A<>#27 do
- begin
- _A:=readkey;
- if _A=#60 Then
- begin
- while not keypressed do
- BEGIN
- delay (3000);
- FOR _I:=1 to 100 do
- for _J:=1 to 100 do
- begin
- if 3=_pole1[_i-1,_j-1]
- +_pole1[_i,_j-1]+_pole1[_i+1,_j-1]+_pole1[_i-1,_j]+_pole1[_i+1,_j]+_pole1[_i-1,_j+1]+_pole1[_i,_j+1]+_pole1[_i+1,_j+1]
- then _Pole2[_I,_J]:=1;
- if 4<=_pole1[_i-1,_j-1]
- +_pole1[_i,_j-1]+_pole1[_i+1,_j-1]+_pole1[_i-1,_j]+_pole1[_i+1,_j]+_pole1[_i-1,_j+1]+_pole1[_i,_j+1]+_pole1[_i+1,_j+1]
- then _Pole2[_I,_J]:=0;
- if 1>=_pole1[_i-1,_j-1]
- +_pole1[_i,_j-1]+_pole1[_i+1,_j-1]+_pole1[_i-1,_j]+_pole1[_i+1,_j]+_pole1[_i-1,_j+1]+_pole1[_i,_j+1]+_pole1[_i+1,_j+1]
- then _Pole2[_I,_J]:=0;
- if 2=_pole1[_i-1,_j-1]
- +_pole1[_i,_j-1]+_pole1[_i+1,_j-1]+_pole1[_i-1,_j]+_pole1[_i+1,_j]+_pole1[_i-1,_j+1]+_pole1[_i,_j+1]+_pole1[_i+1,_j+1]
- then _Pole2[_I,_J]:=_Pole1[_I,_J];
- end;
- FOR _I:=1 to 100 do
- for _J:=1 to 100 do
- begin
- _Pole1[_I,_J]:=_Pole2[_I,_J];
- end;
- For _I:=__X+1 to __X+50 do
- For _J:=__Y+1 to __Y+25 do
- begin
- textbackground(1);
- textcolor(7);
- gotoxy(_I-__X,_J-__Y);
- if (_I=_X)and(_J=_Y) then begin
- textbackground(7);
- textcolor(1);
- end;
- if _Pole1[_I,_J]=0 then Write(#178) else Write(#245);
- end;
- for _I:=1 to 24 do begin gotoxy(51,_I); WRITE(' '); end;
- gotoxy(51,1); WRITE(' _X=',_X,' __X=',__X);
- gotoxy(51,3); WRITE(' _Y=',_Y,' __Y=',__Y);
- gotoxy(51,5); WRITE(' Очистить все F1');
- gotoxy(51,7); WRITE(' жизнь до клавиши F2');
- end;
- end;
- if _A=#59 Then
- begin
- For _J:=0 to 101 do
- For _I:=0 to 50 do begin
- _Pole1[_I*2+1,_j]:=0;_Pole2[_I*2+1,_j]:=0;_Pole1[_I*2,_j]:=0;_Pole2[_I*2,_j]:=0;
- end;
- end;
- if _A=#77 Then _X:=_X+1;
- if _A=#75 Then _X:=_X-1;
- if _A=#80 Then _Y:=_Y+1;
- if _A=#72 Then _Y:=_Y-1;
- if _A=#32 Then If _Pole1[_X,_Y]=0 then _Pole1[_X,_Y]:=1 else _Pole1[_X,_Y]:=0;
- if _A=#13 Then
- BEGIN
- FOR _I:=1 to 100 do
- for _J:=1 to 100 do
- begin
- if 3=_pole1[_i-1,_j-1]
- +_pole1[_i,_j-1]+_pole1[_i+1,_j-1]+_pole1[_i-1,_j]+_pole1[_i+1,_j]+_pole1[_i-1,_j+1]+_pole1[_i,_j+1]+_pole1[_i+1,_j+1]
- then _Pole2[_I,_J]:=1;
- if 4<=_pole1[_i-1,_j-1]
- +_pole1[_i,_j-1]+_pole1[_i+1,_j-1]+_pole1[_i-1,_j]+_pole1[_i+1,_j]+_pole1[_i-1,_j+1]+_pole1[_i,_j+1]+_pole1[_i+1,_j+1]
- then _Pole2[_I,_J]:=0;
- if 1>=_pole1[_i-1,_j-1]
- +_pole1[_i,_j-1]+_pole1[_i+1,_j-1]+_pole1[_i-1,_j]+_pole1[_i+1,_j]+_pole1[_i-1,_j+1]+_pole1[_i,_j+1]+_pole1[_i+1,_j+1]
- then _Pole2[_I,_J]:=0;
- if 2=_pole1[_i-1,_j-1]
- +_pole1[_i,_j-1]+_pole1[_i+1,_j-1]+_pole1[_i-1,_j]+_pole1[_i+1,_j]+_pole1[_i-1,_j+1]+_pole1[_i,_j+1]+_pole1[_i+1,_j+1]
- then _Pole2[_I,_J]:=_Pole1[_I,_J];
- end;
- FOR _I:=1 to 100 do
- for _J:=1 to 100 do
- begin
- _Pole1[_I,_J]:=_Pole2[_I,_J];
- end;
- END;
- if _X<1 then _x:=1 ;
- if _X>100 then _X:=100 ;
- if _Y<1 then _Y:=1 ;
- if _Y>100 then _Y:=100 ;
- if (_Y<=__Y)AND(_Y>0) then __Y:=__Y-1 ;
- if (_Y>__Y+25)and(_Y<=100) then __Y:=__Y+1 ;
- if __Y<0 then __Y:=0 ;
- if __Y>76 then __Y:=76 ;
- if (_X<=__X)AND(_X>0) then __X:=__X-1 ;
- if (_X>__X+50)and(_X<=100) then __X:=__X+1 ;
- if __X<0 then __X:=0 ;
- if __X>51 then __X:=76 ;
- For _I:=__X+1 to __X+50 do
- For _J:=__Y+1 to __Y+25 do
- begin
- textbackground(1);
- textcolor(7);
- gotoxy(_I-__X,_J-__Y);
- if (_I=_X)and(_J=_Y) then begin
- textbackground(7);
- textcolor(1);
- end;
- if _Pole1[_I,_J]=0 then Write(#178) else Write(#245);
- end;
- for _I:=1 to 24 do begin gotoxy(51,_I); WRITE(' '); end;
- gotoxy(51,1); WRITE(' _X=',_X,' __X=',__X);
- gotoxy(51,3); WRITE(' _Y=',_Y,' __Y=',__Y);
- gotoxy(51,5); WRITE(' Очистить все F1');
- gotoxy(51,7); WRITE(' жизнь до клавиши F2');
- end;
- end.
Add Comment
Please, Sign In to add comment