Java 2D array diagonals for game
问题 To clarify I only wanted one or two for loops to help me on my way, preferably in the same style as I had used in the vertical :) I'm making a game using a 2D array, and I need a check that tests if at the current position (indicated by a green square) the character there is part of a diagonal sequence of "l" more of the character. 回答1: public static boolean diagonals(char[][] b, int row, int col, int l) { int counter = 1; // because we start from the current position char charAtPosition = b