Program Grupul_radacinilor_din_unitate;
uses crt, graph, dos;
var
    gd,gm:integer;
    cx,cy,ex,ey,r,o,s,ls,i:word;
    i2, cl, k, inter:real;
    c: char;

begin
    clrscr;
    gd:=Detect;
    initGraph(gd,gm,'');

    ex:=getmaxx div 2;
    ey:=getmaxy div 2;
    r:=(ex+ey) div 3;

    inter:=0.001;
    i2:=inter;
    k:=0;
    o:=1;
    GetTime(cx,cy,s,i);
    ls:=s+15;
    repeat
        GetTime(cx,cy,s,i);
        cx:=ex-round(r*cos(2*pi*k/o+k)/2);
        cy:=ey-round(r*sin(2*pi*k/o+k)/2);
        for i:=0 to (o-1)  do begin
            setcolor(trunc(k+i*$ffff/o));
            line(cx,cy,cx+round(r*cos(2*pi*i/o+k)),cy+round(r*sin(2*pi*i/o+k)));
            // Circle(cx,cy,r);
        end;
        k:=k+i2;
        if (ls+60-s)mod 60<1 then begin
            inc(o); i2:=inter*(o);
            ls:=(s+13)mod 60;
        end;
        if keypressed then begin
            c := readkey;
            case c of
                #72:inc(o);  #80:dec(o);
                #27:begin closeGraph; halt;end;
            end;
           // writeln(c, ':', ord(c));
         if o=0 then o:=1;
         i2 := inter * o;
        end;
    until false;
end.
