Four consecutive pattern program
Hi all! I'm trying to make a program in Java that does the following:
The user first enters number of rows and columns for a "table". Then a two dimensional array is created using the amount of rows and columns for each dimension respectively. This array is then filled with numbers. For the time being, I am generating random numbers from 0 to 9 to fill the array. Up to this point, I'm having no problems.
Now, here's the good part. After filling the array, the program is supposed to tell you if there are any four consecutive same numbers in the array, be it horizontally, vertically or diagonally. I'm having a hard time finding a logic that could work for this program, but every time I think of something it doesn't work. Recently I made a console TicTacToe game in Java, and I assume that the logic for this program is similar to the one I used in the game, but the difference is that the TicTacToe array is 3X3 constant, plus you only have two characters to check: "X" and "O". Whereas in this program, you can have any number, and any size of array.
Any help that you can provide me will be greatly appreciated, as I've kept trying to find an answer to this but have been unsuccessful.