Skip to main content

Posts

Showing posts with the label sudoku

Creating 9 subarrays from a 9x9 2d array java

Hello I need help creating 9 sub arrays of 3x3 dimensions from a 9x9 array. I've seen that stackOverflow had a similar question already asked but unfortunately it was in c++. Can anyone point me in the right direction of how to create a a sub array. Edit: had aa similar changed to had a similar public static void Validate(final int[][] sudokuBoard) { int width = sudokuBoard[0].length; int height = sudokuBoard.length; for(int i = 0; i < width; i++) if(!IsValidRow(sudokuBoard, i, width)) { System.out.print("(Row)" + i + " Error Detected \n"); //Do something - The row has repetitions } for(int j = 0; j < height; j++) if(!IsValidColumn(sudokuBoard, j, height)) { System.out.print(" (Column)" + j + " Error Detected \n"); //Do something - The columns has repetitions } // for(int i=0; i<3; i++) // if(!isBlock1Valid(sudokuB