question: private final int rookBonus ( Position pos ) { int score = 0 ; final long wPawns = pos . pieceTypeBB [ Piece . WPAWN ] ; final long bPawns = pos . pieceTypeBB [ Piece . BPAWN ] ; final long occupied = pos . whiteBB | pos . blackBB ; long m = pos . pieceTypeBB [ Piece . WROOK ] ; while ( m != 0 ) { int sq = BitBoard . numberOfTrailingZeros ( m ) ; final int x = Position . getX ( sq ) ; if ( ( wPawns & BitBoard . maskFile [ x ] ) == 0 ) { score += ( bPawns & BitBoard . maskFile [ x ] ) == 0 ? 25 : 12 ; } long atk = BitBoard . rookAttacks ( sq , occupied ) ; wAttacksBB |= atk ; score += rookMobScore [ Long . bitCount ( atk & ~ ( pos . whiteBB | bPawnAttacks ) ) ] ; if ( ( atk & bKingZone ) != 0 ) bKingAttacks += Long . bitCount ( atk & bKingZone ) ; m &= m - 1 ; } long r7 = ( pos . pieceTypeBB [ Piece . WROOK ] > > > 48 ) & 0x00ffL ; if ( ( ( r7 & ( r7 - 1 ) ) != 0 ) && ( ( pos . pieceTypeBB [ Piece . BKING ] & 0xff00000000000000L ) != 0 ) ) score += 30 ; m = pos . pieceTypeBB [ Piece . BROOK ] ; while ( m != 0 ) { int sq = BitBoard . numberOfTrailingZeros ( m ) ; final int x = Position . getX ( sq ) ; if ( ( bPawns & BitBoard . maskFile [ x ] ) == 0 ) { score -= ( wPawns & BitBoard . maskFile [ x ] ) == 0 ? 25 : 12 ; } long atk = BitBoard . rookAttacks ( sq , occupied ) ; bAttacksBB |= atk ; score -= rookMobScore [ Long . bitCount ( atk & ~ ( pos . blackBB | wPawnAttacks ) ) ] ; if ( ( atk & wKingZone ) != 0 ) wKingAttacks += Long . bitCount ( atk & wKingZone ) ; m &= m - 1 ; } r7 = pos . pieceTypeBB [ Piece . BROOK ] & 0xff00L ; if ( ( ( r7 & ( r7 - 1 ) ) != 0 ) && ( ( pos . pieceTypeBB [ Piece . WKING ] & 0xffL ) != 0 ) ) score -= 30 ; return score ; }
target:  Compute rook bonus. Rook on open/half-open file. 