【发布时间】:2014-05-11 23:28:45
【问题描述】:
我不完全知道如何措辞,但我想知道如何根据下面的 if 语句确定的内容返回某事是否为真。如果你不明白我在问什么,我很抱歉,但是如果你看一下代码,我想你会明白我在问什么。
代码
public boolean isFinished()
{
int row = 0;
int column = 0;
if(box[row][column].getValue() != 0)
{
if(box[row][column].getValue == box[row][column+1].getValue() && box[row][column].getValue == box[row][column+2].getValue())
{
return true;
}
else if(box[row+1][column].getValue == box[row+1][column+1].getValue() && box[row+1][column].getValue == box[row+1][column+2].getValue())
{
return true;
}
else if(box[row+2][column].getValue == box[row+2][column+1].getValue() && box[row+2][column].getValue == box[row+2][column+1].getValue())
{
return true;
}
else if(box[row][column].getValue == box[row+1][column].getValue() && box[row][column].getValue == box[row+2][column].getValue())
{
return true;
}
else if(box[row][column+1].getValue == box[row+1][column+1].getValue() && box[row][column+1].getValue == box[row+2][column+1].getValue())
{
return true;
}
else if(box[row][column+2].getValue == box[row+1][column+2].getValue() && box[row+1][column].getValue == box[row+2][column+2].getValue())
{
return true;
}
else
{
return false;
}
}
//return whether it's true or false
}
【问题讨论】: