Im a begginner and i was wondering if anyone could tell me what im doing wrong here with this word search ? im stuck on checking each row for a word specified in the formal argument, currently it doesnt do any checks of any sort its jst a basic boolean method which returns true if a word is found within a row of the array.assuming the word search array is rectangular
public boolean checkRow( char[][] puzzle, String w)
{
int counter = 0;
boolean match = true;
for ( int row = 0; row < puzzle.length; row++)
{
counter = 0;
for ( int col = 0; col < puzzle[row].length; col++)
{
if ( counter <= w.length() )
{
char word = puzzle[row][col];
if( w.charAt(counter) == word)
{
match = true;
counter++;
}
}
else if ((counter == w.length()) && (match == true))
{
return true;
}
else
{
match = false;
counter = 0;
}
}
}
return match;
}