protected ArrayList<Position> getBgPiecesNrby(Board b, Position tgt) {
      ArrayList<Position> posArray = tgt.adjacentP(b, false, false);
      int i;
      Rank r1 = Rank.Engineer;
      Position pos1 = null;
      Rank r2 = Rank.Engineer;
      Position pos2 = null;
      Piece p = null;
      
      for (i = 0; i < posArray.size(); ++i) {
         // for all the position that is adjacent to the current one
         p = b.getPiece(posArray.get(i).getRow(), 
                        posArray.get(i).getCol());
         if (Piece.movableRank(p.getRank())) {
            // get the biggest one
            if (!Piece.rankGreaterThan(r1, p.getRank())) {
               r1 = p.getRank();
               pos1 = posArray.get(i);
            }
            else if (!Piece.rankGreaterThan(r2, p.getRank())) {
               r2 = p.getRank();
               pos2 = posArray.get(i);
            }  
         }
      }
      
      if (pos1 != null) {
         // if at least one piece was found
         posArray = new ArrayList<Position>();
         posArray.add(pos1);
         if (pos2 != null) {
            // if two pieces was found
            posArray.add(pos2);
         }
         return posArray;
      }
      else {
         // no piece was found
         return null;
      }
   }