Uses robot;
begin
Task('if3');
if (WallFromRight and WallFromDown) then
begin
Left; Up;
end
else
if (WallFromDown and WallFromLeft) then
begin
Up; Right;
end
else
if (WallFromLeft and WallFromUp) then
begin
Right; Down;
end
else
if (WallFromUp and WallFromRight) then
begin
Down; Left;
end;
Paint;
end.