In one of the steps of the assignment, in says this: Write a method in the Board Class which is given a character c. The method should determine if any of the rows in the board contain a sequence of 4 or more of the given characters (e.g. if we have "connected four"). The method should return true if such a sequence exists in the board and false otherwise.
NOTE: The whole assignment is about creating a board , the getRow(int i) will return the index of i row as a String, and getSequence(char c,int i) is just return a String that contains i number of char c.
what I wrote didnt work, can any one tell me why???
public boolean isConnectedFour(char c){ boolean notStop = true; if(getRow(0).length()>=FOUR){ for(int i = 0; i<size && notStop; i++){ int index =getRow(i).indexOf(c); if(getRow(i).substring(index,index+4).equals(getSequence(c,FOUR))){ notStop = false; return true; } else return false;
}
} else return false;
}