//实现游戏逻辑
//@Override
protected boolean setTileIfValid(int x , int y , int value){
int tiles[] = getUsedTiles(x,y);
if(value != 0){
for (int tile : tiles){
if(tile == value)
return false;
//else
//return true;
}
setTile(x,y,value);
calculateUsedTiles();
return true;
}
}错误提示的是
Multiple ers at this line
- Method breakpoint:Game [entry] - setTileIfValid(int,
int, int)
- This method must return a result of type boolean
//@Override
protected boolean setTileIfValid(int x , int y , int value){
int tiles[] = getUsedTiles(x,y);
if(value != 0){
for (int tile : tiles){
if(tile == value)
return false;
//else
//return true;
}
setTile(x,y,value);
calculateUsedTiles();
return true;
}
}错误提示的是
Multiple ers at this line
- Method breakpoint:Game [entry] - setTileIfValid(int,
int, int)
- This method must return a result of type boolean
protected boolean setTileIfValid(int x , int y , int value){
int tiles[] = getUsedTiles(x,y);
if(value != 0){
for (int tile : tiles){
if(tile == value)
return false;
//else
//return true;
}
setTile(x,y,value);
calculateUsedTiles();
return true;
}
return false;
}函数指定了返回值,那么每个出口都要有return。你少了一个,value==0的话,没有return