private final boolean addDirection(ArrayList<Move> moveList,Position pos,int sq0,int maxSteps,int delta){
  int sq=sq0;
  boolean wtm=pos.whiteMove;
  final int oKing=(wtm ? Piece.BKING : Piece.WKING);
  while (maxSteps > 0) {
    sq+=delta;
    int p=pos.getPiece(sq);
    if (p == Piece.EMPTY) {
      moveList.add(getMoveObj(sq0,sq,Piece.EMPTY));
    }
 else {
      if (Piece.isWhite(p) != wtm) {
        if (p == oKing) {
          returnMoveList(moveList);
          moveList=getMoveListObj();
          moveList.add(getMoveObj(sq0,sq,Piece.EMPTY));
          return true;
        }
 else {
          moveList.add(getMoveObj(sq0,sq,Piece.EMPTY));
        }
      }
      break;
    }
    maxSteps--;
  }
  return false;
}

private final boolean addDirection ( ArrayList < Move > moveList , Position pos , int sq0 , int maxSteps , int delta ) { int sq = sq0 ; boolean wtm = pos . whiteMove ; final int oKing = ( wtm ? Piece . BKING : Piece . WKING ) ; while ( maxSteps > 0 ) { sq += delta ; int p = pos . getPiece ( sq ) ; if ( p == Piece . EMPTY ) { moveList . add ( getMoveObj ( sq0 , sq , Piece . EMPTY ) ) ; } else { if ( Piece . isWhite ( p ) != wtm ) { if ( p == oKing ) { returnMoveList ( moveList ) ; moveList = getMoveListObj ( ) ; moveList . add ( getMoveObj ( sq0 , sq , Piece . EMPTY ) ) ; return true ; } else { moveList . add ( getMoveObj ( sq0 , sq , Piece . EMPTY ) ) ; } } break ; } maxSteps -- ; } return false ; }
add all moves from square sq0 in direction delta .
