H
hunyuan
Unregistered / Unconfirmed
GUEST, unregistred user!
begin
if (abs(NewX-OldX)=abs(NewY-OldY)) then
begin
if OldX>NewX then
begin
for i:=NewX to OldX do
begin
if OldY>NewY then
for j:=NewY to OldY do
begin
if Abs(OldX-i)=Abs(OldY-j) then
if (Place[i,j].Color<>0) and
(Place[i,j].Color<>Place[OldX,OldY].Color) then
begin
Exit;
end;
end
else if OldY<NewY then
for j:=OldY to NewY do
begin
if Abs(OldX-i)=Abs(OldY-j) then
if (Place[i,j].Color<>0) and
(Place[i,j].Color<>Place[OldX,OldY].Color) then
begin
Exit;
end;
end;
end;
end
else if OldX<NewX then
begin
for i:=OldX to NewY do
begin
if OldY>NewY then
begin
for j:=NewY to OldY do
begin
if Abs(OldX-i)=Abs(OldY-j) then
if (Place[i,j].Color<>0) and
(Place[i,j].Color<>Place[OldX,OldY].Color) then
begin
Exit;
end;
end;
end
else if OldY<NewY then
for j:=OldY to NewY do
begin
if Abs(OldX-i)=Abs(OldY-j) then
if (Place[i,j].Color<>0) and
(Place[i,j].Color<>Place[OldX,OldY].Color) then
begin
Exit;
end;
end;
end;
end
怎么确定一个IF或FOR的结束,或是写这样的语句有什么原则吗?