QQ对对碰相连点击算法疑问!!
//获取交换点Function GetPoint():twoXy; //获取可交换的2个点
var
x,y,t1:byte;
qp:QP_Array;
begin
//////////////////////////////////// ///为什么遍历某列for y:=1 to 7 do 这里循环的7 而不是8,而qp:=qp;【y+1】又是什么意思啊。
for x:=1 to 8 do//1-8列
for y:=1 to 7 do// 遍历某列
begin
updataChess; //更新棋盘数据
qp:=ChessData;
t1:=qp;
qp:=qp;
qp:=t1; //交换相临棋子
ifTestChess(qp) then
begin
result.X:=x;
result.Y:=y;
result.X:=x;
result.Y:=y+1;
exit;
end;
end;//end for
for y:=1 to 8 do
for x:=1 to 7 do
begin
updataChess;//更新棋盘数据
qp :=ChessData;//
t1:=qp;
qp:=qp;
qp:=t1; //交换相临的2点
ifTestChess(qp) then
begin //如果交换后的棋盘 存在 三个相同的棋子相连
result.X:=x;
result.Y:=y;
result.X:=x+1;
result.Y:=y;
exit;
end;
end;//end for
//
end; //end Function
为什么遍历某列for y:=1 to 7 do 这里循环的7 而不是8,而qp:=qp;【y+1】又是什么意思啊。
而又怎么看他是遍历的到底是列还是行啊。我断点调式发现循环棋盘的数据都是行,而没发现列遍历
页:
[1]