question: public static final ArrayList < Move > removeIllegal ( Position pos , ArrayList < Move > moveList ) { ArrayList < Move > ret = new ArrayList < Move > ( ) ; UndoInfo ui = new UndoInfo ( ) ; int mlSize = moveList . size ( ) ; for ( int mi = 0 ; mi < mlSize ; mi ++ ) { Move m = moveList . get ( mi ) ; pos . makeMove ( m , ui ) ; pos . setWhiteMove ( ! pos . whiteMove ) ; if ( ! inCheck ( pos ) ) ret . add ( m ) ; pos . setWhiteMove ( ! pos . whiteMove ) ; pos . unMakeMove ( m , ui ) ; } return ret ; }
target:  Remove all illegal moves from moveList. "moveList" is assumed to be a list of pseudo-legal moves. This function removes the moves that don't defend from check threats.