private final int tradeBonus(Position pos){
  final int wM=pos.wMtrl;
  final int bM=pos.bMtrl;
  final int wPawn=pos.wMtrlPawns;
  final int bPawn=pos.bMtrlPawns;
  final int deltaScore=wM - bM;
  int pBonus=0;
  pBonus+=interpolate((deltaScore > 0) ? wPawn : bPawn,0,-30 * deltaScore / 100,6 * pV,0);
  pBonus+=interpolate((deltaScore > 0) ? bM : wM,0,30 * deltaScore / 100,qV + 2 * rV + 2 * bV + 2 * nV,0);
  return pBonus;
}

private final int tradeBonus ( Position pos ) { final int wM = pos . wMtrl ; final int bM = pos . bMtrl ; final int wPawn = pos . wMtrlPawns ; final int bPawn = pos . bMtrlPawns ; final int deltaScore = wM - bM ; int pBonus = 0 ; pBonus += interpolate ( ( deltaScore > 0 ) ? wPawn : bPawn , 0 , - 30 * deltaScore / 100 , 6 * pV , 0 ) ; pBonus += interpolate ( ( deltaScore > 0 ) ? bM : wM , 0 , 30 * deltaScore / 100 , qV + 2 * rV + 2 * bV + 2 * nV , 0 ) ; return pBonus ; }
implement the " when ahead trade pieces , when behind trade pawns " rule .
