private final void computePawnHashData(Position pos,PawnHashData ph){
  int score=0;
  long wPawns=pos.pieceTypeBB[Piece.WPAWN];
  long wPawnFiles=BitBoard.southFill(wPawns) & 0xff;
  int wDouble=Long.bitCount(wPawns) - Long.bitCount(wPawnFiles);
  int wIslands=Long.bitCount(((~wPawnFiles) >>> 1) & wPawnFiles);
  int wIsolated=Long.bitCount(~(wPawnFiles << 1) & wPawnFiles & ~(wPawnFiles >>> 1));
  long bPawns=pos.pieceTypeBB[Piece.BPAWN];
  long bPawnFiles=BitBoard.southFill(bPawns) & 0xff;
  int bDouble=Long.bitCount(bPawns) - Long.bitCount(bPawnFiles);
  int bIslands=Long.bitCount(((~bPawnFiles) >>> 1) & bPawnFiles);
  int bIsolated=Long.bitCount(~(bPawnFiles << 1) & bPawnFiles & ~(bPawnFiles >>> 1));
  score-=(wDouble - bDouble) * 25;
  score-=(wIslands - bIslands) * 15;
  score-=(wIsolated - bIsolated) * 15;
  long wPawnAttacks=(((wPawns & BitBoard.maskBToHFiles) << 7) | ((wPawns & BitBoard.maskAToGFiles) << 9));
  long bPawnAttacks=(((bPawns & BitBoard.maskBToHFiles) >>> 9) | ((bPawns & BitBoard.maskAToGFiles) >>> 7));
  long wBackward=wPawns & ~((wPawns | bPawns) >>> 8) & (bPawnAttacks >>> 8)& ~BitBoard.northFill(wPawnAttacks);
  wBackward&=(((wPawns & BitBoard.maskBToHFiles) >>> 9) | ((wPawns & BitBoard.maskAToGFiles) >>> 7));
  wBackward&=~BitBoard.northFill(bPawnFiles);
  long bBackward=bPawns & ~((wPawns | bPawns) << 8) & (wPawnAttacks << 8)& ~BitBoard.southFill(bPawnAttacks);
  bBackward&=(((bPawns & BitBoard.maskBToHFiles) << 7) | ((bPawns & BitBoard.maskAToGFiles) << 9));
  bBackward&=~BitBoard.northFill(wPawnFiles);
  score-=(Long.bitCount(wBackward) - Long.bitCount(bBackward)) * 15;
  long passedPawnsW=wPawns & ~BitBoard.southFill(bPawns | bPawnAttacks | (wPawns >>> 8));
  final int[] ppBonus={-1,24,26,30,36,55,100,-1};
  int passedBonusW=0;
  if (passedPawnsW != 0) {
    long guardedPassedW=passedPawnsW & (((wPawns & BitBoard.maskBToHFiles) << 7) | ((wPawns & BitBoard.maskAToGFiles) << 9));
    passedBonusW+=15 * Long.bitCount(guardedPassedW);
    long m=passedPawnsW;
    while (m != 0) {
      int sq=Long.numberOfTrailingZeros(m);
      int y=Position.getY(sq);
      passedBonusW+=ppBonus[y];
      m&=m - 1;
    }
  }
  long passedPawnsB=bPawns & ~BitBoard.northFill(wPawns | wPawnAttacks | (bPawns << 8));
  int passedBonusB=0;
  if (passedPawnsB != 0) {
    long guardedPassedB=passedPawnsB & (((bPawns & BitBoard.maskBToHFiles) >>> 9) | ((bPawns & BitBoard.maskAToGFiles) >>> 7));
    passedBonusB+=15 * Long.bitCount(guardedPassedB);
    long m=passedPawnsB;
    while (m != 0) {
      int sq=Long.numberOfTrailingZeros(m);
      int y=Position.getY(sq);
      passedBonusB+=ppBonus[7 - y];
      m&=m - 1;
    }
  }
  ph.key=pos.pawnZobristHash();
  ph.score=score;
  ph.passedBonusW=(short)passedBonusW;
  ph.passedBonusB=(short)passedBonusB;
  ph.passedPawnsW=passedPawnsW;
  ph.passedPawnsB=passedPawnsB;
}

private final void computePawnHashData ( Position pos , PawnHashData ph ) { int score = 0 ; long wPawns = pos . pieceTypeBB [ Piece . WPAWN ] ; long wPawnFiles = BitBoard . southFill ( wPawns ) & 0xff ; int wDouble = Long . bitCount ( wPawns ) - Long . bitCount ( wPawnFiles ) ; int wIslands = Long . bitCount ( ( ( ~ wPawnFiles ) > > > 1 ) & wPawnFiles ) ; int wIsolated = Long . bitCount ( ~ ( wPawnFiles << 1 ) & wPawnFiles & ~ ( wPawnFiles > > > 1 ) ) ; long bPawns = pos . pieceTypeBB [ Piece . BPAWN ] ; long bPawnFiles = BitBoard . southFill ( bPawns ) & 0xff ; int bDouble = Long . bitCount ( bPawns ) - Long . bitCount ( bPawnFiles ) ; int bIslands = Long . bitCount ( ( ( ~ bPawnFiles ) > > > 1 ) & bPawnFiles ) ; int bIsolated = Long . bitCount ( ~ ( bPawnFiles << 1 ) & bPawnFiles & ~ ( bPawnFiles > > > 1 ) ) ; score -= ( wDouble - bDouble ) * 25 ; score -= ( wIslands - bIslands ) * 15 ; score -= ( wIsolated - bIsolated ) * 15 ; long wPawnAttacks = ( ( ( wPawns & BitBoard . maskBToHFiles ) << 7 ) | ( ( wPawns & BitBoard . maskAToGFiles ) << 9 ) ) ; long bPawnAttacks = ( ( ( bPawns & BitBoard . maskBToHFiles ) > > > 9 ) | ( ( bPawns & BitBoard . maskAToGFiles ) > > > 7 ) ) ; long wBackward = wPawns & ~ ( ( wPawns | bPawns ) > > > 8 ) & ( bPawnAttacks > > > 8 ) & ~ BitBoard . northFill ( wPawnAttacks ) ; wBackward &= ( ( ( wPawns & BitBoard . maskBToHFiles ) > > > 9 ) | ( ( wPawns & BitBoard . maskAToGFiles ) > > > 7 ) ) ; wBackward &= ~ BitBoard . northFill ( bPawnFiles ) ; long bBackward = bPawns & ~ ( ( wPawns | bPawns ) << 8 ) & ( wPawnAttacks << 8 ) & ~ BitBoard . southFill ( bPawnAttacks ) ; bBackward &= ( ( ( bPawns & BitBoard . maskBToHFiles ) << 7 ) | ( ( bPawns & BitBoard . maskAToGFiles ) << 9 ) ) ; bBackward &= ~ BitBoard . northFill ( wPawnFiles ) ; score -= ( Long . bitCount ( wBackward ) - Long . bitCount ( bBackward ) ) * 15 ; long passedPawnsW = wPawns & ~ BitBoard . southFill ( bPawns | bPawnAttacks | ( wPawns > > > 8 ) ) ; final int [ ] ppBonus = { - 1 , 24 , 26 , 30 , 36 , 55 , 100 , - 1 } ; int passedBonusW = 0 ; if ( passedPawnsW != 0 ) { long guardedPassedW = passedPawnsW & ( ( ( wPawns & BitBoard . maskBToHFiles ) << 7 ) | ( ( wPawns & BitBoard . maskAToGFiles ) << 9 ) ) ; passedBonusW += 15 * Long . bitCount ( guardedPassedW ) ; long m = passedPawnsW ; while ( m != 0 ) { int sq = Long . numberOfTrailingZeros ( m ) ; int y = Position . getY ( sq ) ; passedBonusW += ppBonus [ y ] ; m &= m - 1 ; } } long passedPawnsB = bPawns & ~ BitBoard . northFill ( wPawns | wPawnAttacks | ( bPawns << 8 ) ) ; int passedBonusB = 0 ; if ( passedPawnsB != 0 ) { long guardedPassedB = passedPawnsB & ( ( ( bPawns & BitBoard . maskBToHFiles ) > > > 9 ) | ( ( bPawns & BitBoard . maskAToGFiles ) > > > 7 ) ) ; passedBonusB += 15 * Long . bitCount ( guardedPassedB ) ; long m = passedPawnsB ; while ( m != 0 ) { int sq = Long . numberOfTrailingZeros ( m ) ; int y = Position . getY ( sq ) ; passedBonusB += ppBonus [ 7 - y ] ; m &= m - 1 ; } } ph . key = pos . pawnZobristHash ( ) ; ph . score = score ; ph . passedBonusW = ( short ) passedBonusW ; ph . passedBonusB = ( short ) passedBonusB ; ph . passedPawnsW = passedPawnsW ; ph . passedPawnsB = passedPawnsB ; }
compute pawn hash data for pos .
