// Не скажу что оптимально но работает uses DrawMan;
const c_x = 8; c_y = 8;
var xi, yi, h: integer;
procedure one_star(x, y, r: integer); var xi, yi, step: integer; begin step := r div 4; for xi := -1 to 1 do for yi := -1 to 1 do begin if (xi * yi <> 0) or (xi + yi = 0) then continue;
ToPoint(x, y); PenDown; ToPoint(x + xi * 4 * step, y + yi * 4 * step); PenUp;
// stop; ToPoint(x + yi * step, y + xi * step); PenDown; ToPoint(x + xi * 4 * step, y + yi * 4 * step); PenUp;
ToPoint(x - yi * step, y - xi * step); PenDown; ToPoint(x + xi * 4 * step, y + yi * 4 * step); PenUp;
ToPoint(x + yi * 2 * step, y + xi * 2 * step); PenDown; ToPoint(x + xi * 3 * step, y + yi * 3 * step); PenUp;
ToPoint(x - yi * 2 * step, y + xi * 2 * step); PenDown; ToPoint(x - xi * 3 * step, y - yi * 3 * step); PenUp;
ToPoint(x + yi * 2 * step, y - xi * 2 * step); PenDown; ToPoint(x - xi * 3 * step, y - yi * 3 * step); PenUp;
end; end;
begin Field(2 * c_x, 2 * c_y);
h := c_x div 2; for xi := -1 to 1 do for yi := -1 to 1 do begin if (xi * yi <> 0) or (xi + yi = 0) then continue; one_star(c_x + xi * h, c_y + yi * h, h);
end; end.
3 votes Thanks 2
AlexFromMinsk
Молодец, всё работает, но есть решение меньшего обьема) поэтому ответ не лучший
Answers & Comments
Verified answer
// Не скажу что оптимально но работаетuses
DrawMan;
const
c_x = 8;
c_y = 8;
var
xi, yi, h: integer;
procedure one_star(x, y, r: integer);
var
xi, yi, step: integer;
begin
step := r div 4;
for xi := -1 to 1 do
for yi := -1 to 1 do
begin
if (xi * yi <> 0) or (xi + yi = 0) then
continue;
ToPoint(x, y);
PenDown;
ToPoint(x + xi * 4 * step, y + yi * 4 * step);
PenUp;
// stop;
ToPoint(x + yi * step, y + xi * step);
PenDown;
ToPoint(x + xi * 4 * step, y + yi * 4 * step);
PenUp;
ToPoint(x - yi * step, y - xi * step);
PenDown;
ToPoint(x + xi * 4 * step, y + yi * 4 * step);
PenUp;
ToPoint(x + yi * 2 * step, y + xi * 2 * step);
PenDown;
ToPoint(x + xi * 3 * step, y + yi * 3 * step);
PenUp;
ToPoint(x - yi * 2 * step, y + xi * 2 * step);
PenDown;
ToPoint(x - xi * 3 * step, y - yi * 3 * step);
PenUp;
ToPoint(x + yi * 2 * step, y - xi * 2 * step);
PenDown;
ToPoint(x - xi * 3 * step, y - yi * 3 * step);
PenUp;
end;
end;
begin
Field(2 * c_x, 2 * c_y);
h := c_x div 2;
for xi := -1 to 1 do
for yi := -1 to 1 do
begin
if (xi * yi <> 0) or (xi + yi = 0) then
continue;
one_star(c_x + xi * h, c_y + yi * h, h);
end;
end.