Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void getSuccessors(Configuration board, int row, ArrayList<Configuration> successors, int X){
- if(row >= X-1){
- if(isValid(board)){
- successors.add(board);
- return;
- }
- } else {
- for(int i = 1; i < (2 * X)-1; i++){
- for(int j = i+1; j < (2 * X)-1; j++){
- Configuration newBoard = new Configuration(X);
- Arrays.fill(newBoard.getConfiguration()[row], i, j+1, 1);
- System.out.println("NewBoard (Row=" + row + ")");
- System.out.println(newBoard.toString());
- getSuccessors(newBoard, row+1, successors, X);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement