I’m making a game and I need to make a method which checks if the specified cell is part of a horizontal consecutive sequence of cells containing the same character. The sequence of cells needs to be of length l. It is true if the cell is part of a horizontal sequence of length at least l, and false otherwise.
So far I have it that it detects if there are at least 5 consecutive cells with the same character anywhere in the row of the character specified. Can anyone help?
You can simply search for both sides using two loops (one per side) and check if the sum of consecutive cells is indeed
l. Something along the lines of: