Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Program Matrix;
- uses crt;
- const x=80;
- y=25;
- speed=3;
- a=20;
- b=45;
- type komorka=record
- znak:byte;
- kolor:boolean;
- end;
- var tablica:array[1..x,1..y] of komorka;
- cykl:array[1..x] of byte;
- dlugosc:array[1..x] of byte;
- przerwa:array[1..x] of integer;
- i,j,k:integer;
- procedure przesun;
- begin
- for i:=1 to x do
- for k:=1 to cykl[i] do
- begin
- for j:=y downto 2 do
- begin
- tablica[i,j].znak:=tablica[i,j-1].znak;
- tablica[i,j].kolor:=tablica[i,j-1].kolor;
- end;
- przerwa[i]:=przerwa[i]-1;
- if przerwa[i]<=0 then
- begin
- tablica[i,1].znak:=random(94)+33;
- if przerwa[i]=0 then tablica[i,1].kolor:=true else tablica[i,1].kolor:=false;
- dlugosc[i]:=dlugosc[i]-1;
- if dlugosc[i]<=0 then przerwa[i]:=random(b)+5;
- end
- else
- begin
- tablica[i,1].znak:=0;
- dlugosc[i]:=random(a)+5;
- end;
- end;
- end;
- procedure rysuj;
- begin
- for i:=1 to x do
- begin
- for j:=1 to y do
- begin
- gotoxy(i,j);
- if tablica[i,j].kolor=true then textcolor(lightgreen) else textcolor(green);
- if tablica[i,j].znak=0 then write(' ') else write(chr(tablica[i,j].znak));
- end;
- end;
- end;
- BEGIN
- clrscr;
- randomize;
- for i:=1 to x do cykl[i]:=random(speed)+1;
- for i:=1 to x do przerwa[i]:=random(b)+5;
- repeat
- przesun;
- rysuj;
- until keypressed;
- delay(1000);
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement