unit kori;
interface
uses graph;
procedure priprav;
procedure domov;
procedure pero_hore;
procedure pero_dole;
procedure vpravo(u:real);
procedure vlavo(u:real);
procedure dopredu(d:integer);
procedure dovi;
procedure zmen_farbu(f:integer);
procedure hruba;
procedure tenka;
procedure zmaz;
const xd=319;yd=239;
var h:boolean;
x,y,uhol:real;
implementation
procedure priprav;
var gd,gm:integer;
cesta:string;
begin
detectgraph(gd,gm);
writeln('Zadaj cestu ku grafike: ');
readln(cesta);
initgraph(gd,gm,cesta);
domov;
end;
procedure domov;
begin
moveto(xd,yd);
x:=xd;y:=yd;
uhol:=-90;
h:=true;
end;
procedure pero_hore;
begin
h:=false;
end;
procedure pero_dole;
begin
h:=true;
end;
procedure vpravo(u:real);
begin
uhol:=(uhol+u);
end;
procedure vlavo(u:real);
begin
vpravo(-u);
end;
procedure dopredu(d:integer);
var pom:real;
begin
pom:=(pi*uhol)/180;
x:=x+d*cos(pom);
y:=y+d*sin(pom);
if h then lineto(round(x),round(y))
else moveto(round(x),round(y));
end;
procedure dovi;
begin
closegraph;
end;
procedure zmen_farbu(f:integer);
begin
setcolor(f);
end;
procedure hruba;
begin
setlinestyle(0,1,3)
end;
procedure tenka;
begin
setlinestyle(0,1,1)
end;
procedure zmaz;
begin
cleardevice;
end;
end.