Фрактальная графика. Задачи 10 класс.

кривая дракона');
SetWindowSize(700,512);
ClearWindow;
ris(200,300,500,300,Z);
Repeat Until KeyPressed
End.

Снежинка Коха на Паскале (Pascal)


uses GraphABC;

procedure Draw(x, y, l, u : Real; t : Integer);

procedure Draw2(
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
·
Кривая Коха на Паскале (Pascal)
uses GraphABC;

procedure Draw(x, y, l, u : Real; t : Integer);

procedure Draw2(Var x, y: Real; l, u : Real; t : Integer);

begin
Draw(x, y, l, u, t);
x := x + l*cos(u);
y := y - l*sin(u);
end;

begin
if t > 0 then
begin
l
·:= l/3;
Draw2(x, y, l, u, t-1);
Draw2(x, y, l, u+pi/3, t-1);
Draw2(x, y, l, u-pi/3, t-1);
Draw2(x, y, l, u, t-1);
end
else
Line(Round(x), Round(y), Round(x+cos(u)*l), Round(y-sin(u)*l))
end;

begin
SetWindowSize(425,500);
SetWindowCaption('Фракталы: Кривая
· Коха');
Draw(10, 254, 400, 0, 4);
end.

Заголовок 315