死循环问题?????
这里fanwei开始为空,tx,ty为整数,list为已经赋值的遗嘱数据,jy为常数!为什么我的循环会成为死循环呀! private void xunhuan(List<int> fanwei, int tx, int ty, List<int> list)
{ if (!(fanwei.Contains(tx * (jy + 1) + ty)))
{
for (int i = (tx - 1); i <= (tx + 1); i++)
{
if ((i>=0)&&(i <= ix))
{
for (int j = (ty - 1); j <= (ty + 1); j++)
{
if ((j>=0)&&(j <= jy))
{
if ((i == tx) && (j == ty))
{
if (!(fanwei.Contains(i * (jy + 1) + j)))
fanwei.Add(i * (jy + 1) + j);
if (list.Contains(i * (jy + 1) + j))
list.Remove(i * (jy + 1) + j);
}
else
{
if (list.Contains(i * (jy + 1) + j))
{
if (!(fanwei.Contains(i * (jy + 1) + j)))
xunhuan(fanwei, i, j, list);
else
list.Remove(i * (jy + 1) + j);
}
else
{
if (!(fanwei.Contains(i * (jy + 1) + j)))
fanwei.Add(i * (jy + 1) + j);
}
}
}
}
}
}
}
else
{
if (list.Contains(tx * (jy + 1) + ty))
{
list.Remove(tx * (jy + 1) + ty);
}
}
}