This repository has been archived on 2024-12-25. You can view files and clone it, but cannot push or open issues or pull requests.
2024-03-10 20:32:51 +03:00

28 lines
581 B
ObjectPascal

// E-квадраты. Демонстрация рекурсии
uses GraphABC;
const mw = 2.9;
procedure ESquares(n,x,y,w: integer);
begin
var w1 := round(w/mw);
var h := (w-2*w1) div 3;
Brush.Color := clRandom;
Rectangle(x,y,x+w,y+w);
if n>0 then
begin
Sleep(1);
ESquares(n-1,x+h,y+h,w1);
ESquares(n-1,x+w-h-w1,y+h,w1);
ESquares(n-1,x+h,y+w-h-w1,w1);
ESquares(n-1,x+w-h-w1,y+w-h-w1,w1);
end;
end;
begin
Window.Title := 'Рекурсия: E-квадраты';
SetWindowSize(750,530);
Pen.Color := clWhite;
ESquares(4,125,18,490);
end.