// to remove white pieces from the board
 private LinkList generateRemove_Black(String board, LinkList LL2) {
   String b;
   int count = 0;
   for (int k = 0; k < board.length(); k++) {
     if (board.charAt(k) == 'W') {
       if (!closeMill(k, board)) {
         count++;
         b = board;
         b = b.substring(0, k) + 'x' + b.substring(k + 1);
         LL2.insert(b);
       }
     }
   }
   if (count == 0) LL2.insert(board);
   return LL2;
 }
 // to generate adjacent moves of the black pieces
 public LinkList generateMove_Black(String board, LinkList LL1) {
   String b;
   int j;
   LL1.first = null;
   int[] n = null;
   for (int i = 0; i < board.length(); i++) {
     if (board.charAt(i) == 'B') {
       n = neighbors(i);
       for (int k = 0; k < n.length; k++) {
         j = n[k];
         if (board.charAt(j) == 'x') {
           b = board;
           b = b.substring(0, i) + 'x' + b.substring(i + 1);
           b = b.substring(0, j) + 'B' + b.substring(j + 1);
           if (closeMill(j, b)) {
             LL1 = generateRemove_Black(b, LL1);
           } else {
             LL1.insert(b);
           }
         }
       }
     }
   }
   return LL1;
 }
  private void generateMidgameEndgame(String in_file, String out_file) {
    // TODO Auto-generated method stub
    // code to read the file
    try {
      // Open the file that is the first
      // command line parameter
      FileInputStream fstream = new FileInputStream(in_file);
      // Get the object of DataInputStream
      DataInputStream in = new DataInputStream(fstream);
      BufferedReader br = new BufferedReader(new InputStreamReader(in));
      String board;
      // Read the first Line
      board = br.readLine();
      L.insert(board);
      // Print the content on the console
      System.out.println("The input board position is:");
      System.out.println(board);
      // Close the input stream
      in.close();
      fstream.close();

    } catch (Exception e) { // Catch exception if any
      System.err.println("Error: " + e.getMessage());
    }
  }
 // to generate hopping moves for black pieces
 public LinkList generateHopping_Black(String board, LinkList LL1) {
   String b;
   LL1.first = null;
   for (int i = 0; i < board.length(); i++) {
     if (board.charAt(i) == 'B') {
       for (int j = 0; j < board.length(); j++) {
         if (board.charAt(j) == 'x') {
           b = board;
           b = b.substring(0, i) + 'x' + b.substring(i + 1);
           b = b.substring(0, j) + 'B' + b.substring(j + 1);
           if (closeMill(j, b)) {
             LL1 = generateRemove_Black(b, LL1);
           } else {
             LL1.insert(b);
           }
         }
       }
     }
   }
   return LL1;
 }