SHARE
TWEET

Untitled

a guest Oct 13th, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public static void getSuccessors(Configuration board, int row, ArrayList<Configuration> successors, int X){
  2.       if(row >= X-1){
  3.         if(isValid(board)){
  4.           successors.add(board);
  5.           return;
  6.         }
  7.       } else {
  8.         for(int i = 1; i < (2 * X)-1; i++){
  9.           for(int j = i+1; j < (2 * X)-1; j++){
  10.             Configuration newBoard = new Configuration(X);
  11.             Arrays.fill(newBoard.getConfiguration()[row], i, j+1, 1);
  12.             System.out.println("NewBoard (Row=" + row + ")");
  13.             System.out.println(newBoard.toString());
  14.             getSuccessors(newBoard, row+1, successors, X);
  15.           }
  16.         }
  17.       }
  18.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top