私は現在、2 つの部分に分割されていた Java の数独ソリューション チェッカーに取り組んでいます。この 2 番目の部分では、5 つの新しい「特定のメソッド」をコードに追加する必要があります。これらのメソッドは、行、列、ブロックのブール チェックであり、ループ内で true または false の場合に戻ります。checkAndPrintReport は、行のチェックの失敗、列のチェックの失敗、ブロックのチェックの失敗ごとに 1 行を出力することも想定されています。
public boolean checkAndPrintReport( )
{
return false;
}
public boolean isGoodRow( int yRowParam )
{
int sum = 0;
for ( int x = 0; x <9; x++)
{
sum = sum + getCell (x,yRowParam);
}
return( true );
}
public boolean isGoodColumn( int xColParam )
{
int sum = 0;
for (int y = 0; y < 9 ;y++)
{
sum = sum + getCell (xColParam, y);
}
return( true );
}
public boolean isGoodBlock(int xBlockP, int yBlockP)
{
int sum = 0;
for (int x=0; x<3; x++)
{
for (int y=0; y<3;y++)
{
sum = sum + getCell (xBlockP+x, yBlockP+y);
}
}
return( true );
}
public boolean checkAll()
{
}
今私を混乱させている主な部分は、これらのことをチェックするためにすでに作成したコードとこれがどのように異なるかということだと思います...だから、私に求められていることについてちょっと混乱しています。