final public int evalPos(Position pos){
  int score=pos.wMtrl - pos.bMtrl;
  wKingAttacks=bKingAttacks=0;
  wKingZone=BitBoard.kingAttacks[pos.getKingSq(true)];
  wKingZone|=wKingZone << 8;
  bKingZone=BitBoard.kingAttacks[pos.getKingSq(false)];
  bKingZone|=bKingZone >>> 8;
  wAttacksBB=bAttacksBB=0L;
  long pawns=pos.pieceTypeBB[Piece.WPAWN];
  wPawnAttacks=((pawns & BitBoard.maskBToHFiles) << 7) | ((pawns & BitBoard.maskAToGFiles) << 9);
  pawns=pos.pieceTypeBB[Piece.BPAWN];
  bPawnAttacks=((pawns & BitBoard.maskBToHFiles) >>> 9) | ((pawns & BitBoard.maskAToGFiles) >>> 7);
  score+=pieceSquareEval(pos);
  score+=pawnBonus(pos);
  score+=tradeBonus(pos);
  score+=castleBonus(pos);
  score+=rookBonus(pos);
  score+=bishopEval(pos,score);
  score+=threatBonus(pos);
  score+=kingSafety(pos);
  score=endGameEval(pos,score);
  if (!pos.whiteMove)   score=-score;
  return score;
}

final public int evalPos ( Position pos ) { int score = pos . wMtrl - pos . bMtrl ; wKingAttacks = bKingAttacks = 0 ; wKingZone = BitBoard . kingAttacks [ pos . getKingSq ( true ) ] ; wKingZone |= wKingZone << 8 ; bKingZone = BitBoard . kingAttacks [ pos . getKingSq ( false ) ] ; bKingZone |= bKingZone > > > 8 ; wAttacksBB = bAttacksBB = 0L ; long pawns = pos . pieceTypeBB [ Piece . WPAWN ] ; wPawnAttacks = ( ( pawns & BitBoard . maskBToHFiles ) << 7 ) | ( ( pawns & BitBoard . maskAToGFiles ) << 9 ) ; pawns = pos . pieceTypeBB [ Piece . BPAWN ] ; bPawnAttacks = ( ( pawns & BitBoard . maskBToHFiles ) > > > 9 ) | ( ( pawns & BitBoard . maskAToGFiles ) > > > 7 ) ; score += pieceSquareEval ( pos ) ; score += pawnBonus ( pos ) ; score += tradeBonus ( pos ) ; score += castleBonus ( pos ) ; score += rookBonus ( pos ) ; score += bishopEval ( pos , score ) ; score += threatBonus ( pos ) ; score += kingSafety ( pos ) ; score = endGameEval ( pos , score ) ; if ( ! pos . whiteMove ) score = - score ; return score ; }
static evaluation of a position .
