program spirale;
{Name: Stefan Ziegler}
{Programm zeichnet Spirale}
uses crt, graph, drivers;

const feld : array[1..10] of byte = (1, 3, 4, 8, 2, 11, 5, 6, 15, 0);
var a, mouseintflag        : byte;
    i, s, t, e, f, w       : integer;
    graphdriver, graphmode : integer;
    ch                     : char;
    durch                  : longint;

procedure movepress;
  begin
    if a=2 then exit;
    {if MouseIntFlag<>0 then a:=a+1;}
    if keypressed then a:=a+1;
  end;

procedure spir(farbe, durch:byte);

  var b, c: byte;

  begin
    setcolor(farbe);
    s:=10+durch*8; t:=0+durch*8; e:=0; f:=0; b:=24;
    for i:=1 to 240 do
      begin
        arc(round(getmaxx/2), round(getmaxy/2), s,t,i);
        s:=t+49; t:=t+50+0;
        if keypressed then exit;
        c:=i mod 10;
        if c=0 then b:=b-1;
        {delay(b);}
      end;
  end;

begin
  a:=0;
  durch:=40;
  graphdriver:=9; graphmode:=2;
  initgraph(graphdriver,graphmode,'d:\tp\bgi');
  t:=0; w:=9;
  {repeat
    cleardevice;
    setcolor(13);
    s:=10; t:=30; e:=0; f:=0;
    for i:=1 to 200 do
       begin
         arc(round(getmaxx/2), round(getmaxy/2), s, t, i);
         s:=t; t:=t+50;
         if i=200 then
           begin
             s:=e; t:=f;
           end;
         movepress;
         if a=1 then w:=10;
       end;
    durch:=durch+1;
    delay(20);
    setcolor(13); 
  until w=10;}
  repeat
    {spir(1, durch);}
    durch:=durch+1;
    spir(feld[((durch div 40) mod 10)+1], durch);
    delay(80);
  until keypressed;
  readln;
  nosound;
  closegraph;
end.