私は自分のプログラムで何か助けが得られるかどうか疑問に思っていました.これらには以下が必要です:
次に、この新しい配列の値を取得および設定する 2 つのパブリック メソッドを追加します。 public void uncover(int thisCol, int thisRow) uncover メソッドは、指定された正方形の状態を false に変更します。それ以外の場合、入力座標が地雷原の外にある場合、または正方形がすでに覆われている場合、何もしません。
public boolean isCovered(int thisCol, int thisRow) isCovered メソッドは、指定された正方形が覆われている場合に true を返します。それ以外の場合、入力座標が地雷原の外にある場合、または正方形が覆われていない場合は、false を返します。
以下にこれらのメソッドを作成しようとしましたが、正しいとは思いません。誰か見てもらえますか?
public void uncover(int thisCol, int thisRow) {
if(thisCol <0 || thisRow < 0)
return null;
if(thisCol>=numCols || thisRow>=numRows)
return null;
}
public boolean isCovered(int thisCol, int thisRow){
if(thisCol >0 || thisRow > 0)
return true;
if(thisCol>=numCols || thisRow>=numRows)
return true;
else;
return null;
}