Скачать Flame1 - BGI Graphics Fire Routine

29.12.1996
Скачать файл (5,65 Кб)




program flame;
uses graph,crt;
const max=182;
var         d,m,dx      : integer;
            i,c,k,r     : integer;
            maxcol,s    : integer;
            v           : byte;
            l           : real;
            a           : array[1..100]of integer;
            st          : string;
 
 
begin
  d:= installuserdriver('svga256',nil);
  m:= 0;
  InitGraph(D, M, '');{Инициализация графического режима}
  if GraphResult <> grOk then
    begin
      Writeln(GraphErrorMsg(GraphResult));
      Halt(1);
    end;
 
      for i:=1 to 63 do setRGBpalette(i,63,63,63-i);
      for i:=64 to 127 do setRGBpalette(i,63,63-i,0);
      for i:=128 to 170 do setRGBpalette(i,63-i,0,0);
      for i:=170 to 255 do setRGBpalette(i,0,0,i+25);
 
 
 randomize;
 repeat { цикл 1 }
  a[1]:=max;
  for i:=2 to 100 do
   begin
    v:=round(6*random+1);
    if i>50 then if v<>7 then a[i]:=a[i-1]+5 else a[i]:=a[i-1]-5
             else if v<>7 then a[i]:=a[i-1]-5 else a[i]:=a[i-1]+5;
    if a[i]<0 then a[i]:=0;
   end;
 
   maxcol:=0;
   for i:= 1 to 100 do if maxcol<a[i] then maxcol:=a[i];
 
   for i:=1 to 100 do a[i]:=trunc(a[i]/maxcol*max+1);
 
  c:=0;
  repeat {1.1}
   for i:=1 to 100 do
     begin
       setfillstyle(1,a[i]);
       bar(50+i,200-c,51+i,199-c);
       inc(a[i]);
       if (a[i]>max)or(a[i]=1) then a[i]:=0;
     end;
   inc(c,2);
    until c>200;
     until keypressed;{ or (c=1); { 1 }
 
 readkey;
 closegraph
end.