[英]Why do I get that SingularValueDecomposition cannot be resolved to a type?
[英]Why do I get “Cannot be Resolved” errors in this code?
我正在嘗試檢查此舉是否適用於游戲“黑白棋”。 我在每個循環中都使用a,並且在使用它要檢查的變量時使用一次(僅一次),這給了我一個“無法解決的錯誤”。 在發生這種情況時,我已經加粗了。 有人可以幫忙嗎? (是的,我知道代碼尚未完成,我正在嘗試首先消除此錯誤。)
public boolean isLegal(Location loc1)
{
String currentColor = currentPlayer.getColor();
boolean isLegal = false;
int row = loc1.getRow();
int col = loc1.getCol();
if(board.isValid(loc1))
{
if(board.get(loc1) == null)
{
for(Location tempLoc : board.getValidAdjacentLocations(loc1))
{
if(!board.get(tempLoc).equals(currentColor))
{
int tempRow = tempLoc.getRow();
if((row != tempLoc.getRow()) && (col == tempLoc.getCol()))
{
//count up column
if(**tempLoc.getRow()** < row)
{
for(int i = row; i > 1;)
{
Location tempLoc2 = new Location(i-2, col);
if(!board.get(tempLoc2).equals(currentColor))
{
i--;
}
else
{
i=-1;
isLegal = true;
}
}
}
//count down column
else
{
for(int i = row; i < 6;)
{
Location tempLoc2 = new Location(i+2, lcol);
if(!board.get(tempLoc2).equals(currentColor))
{
i++;
}
else
i=9;
isLegal = true;
}
}
}
else if(col != tempLoc.getCol() && row == tempLoc.getRow())
{
//count left/right row
if(col > tempLoc.getCol())
{
}
else
}
else
{ //count up/right & down/left diag
if(1!=0)
{
}
//count up/left & down/right diag
else
}
}
}
}
}
return isLegal;
}
在代碼底部沒有主體的“ else”語句使編譯器無法理解循環內部的內容。 如果您修復了該錯誤,則另一個錯誤將消失。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.