From: Fabian Fichter Date: Sun, 9 Aug 2020 12:45:16 +0000 (+0200) Subject: Merge official-stockfish/master X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=7f4a2d75b7772a64383ff340939d852333775db7;p=fairystockfish.git Merge official-stockfish/master No functional change. --- 7f4a2d75b7772a64383ff340939d852333775db7 diff --cc src/evaluate.cpp index ccb8de7,9d7728c..079171d --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@@ -1178,19 -815,16 +1178,20 @@@ namespace initialize(); initialize(); - // Pieces evaluated first (also populates attackedBy, attackedBy2). - // Note that the order of evaluation of the terms is left unspecified - score += pieces() - pieces() - + pieces() - pieces() - + pieces() - pieces() - + pieces() - pieces(); + // Pieces should be evaluated first (populate attack tables). + // For unused piece types, we still need to set attack bitboard to zero. + for (PieceType pt = KNIGHT; pt < KING; ++pt) + if (pt != SHOGI_PAWN) + score += pieces(pt) - pieces(pt); + + // Evaluate pieces in hand once attack tables are complete + if (pos.piece_drops() || pos.seirawan_gating()) + for (PieceType pt = PAWN; pt < KING; ++pt) + score += hand(pt) - hand(pt); - score += mobility[WHITE] - mobility[BLACK]; + score += (mobility[WHITE] - mobility[BLACK]) * (1 + pos.captures_to_hand() + pos.must_capture() + pos.check_counting()); + // More complex interactions that require fully populated attack bitboards score += king< WHITE>() - king< BLACK>() + threats() - threats() + passed< WHITE>() - passed< BLACK>() diff --cc src/pawns.cpp index 95c1681,7b266e7..697c8c7 --- a/src/pawns.cpp +++ b/src/pawns.cpp @@@ -97,16 -96,16 +96,16 @@@ namespace // Flag the pawn opposed = theirPawns & forward_file_bb(Us, s); - blocked = theirPawns & (s + Up); + blocked = is_ok(s + Up) ? theirPawns & (s + Up) : Bitboard(0); stoppers = theirPawns & passed_pawn_span(Us, s); - lever = theirPawns & PawnAttacks[Us][s]; - leverPush = theirPawns & PawnAttacks[Us][s + Up]; - doubled = ourPawns & (s - Up); + lever = theirPawns & PseudoAttacks[Us][PAWN][s]; + leverPush = relative_rank(Them, s, pos.max_rank()) > RANK_1 ? theirPawns & PseudoAttacks[Us][PAWN][s + Up] : Bitboard(0); + doubled = r > RANK_1 ? ourPawns & (s - Up) : Bitboard(0); neighbours = ourPawns & adjacent_files_bb(s); phalanx = neighbours & rank_bb(s); - support = neighbours & rank_bb(s - Up); + support = r > RANK_1 ? neighbours & rank_bb(s - Up) : Bitboard(0); - e->blockedCount[Us] += blocked || more_than_one(leverPush); + e->blockedCount += blocked || more_than_one(leverPush); // A pawn is backward when it is behind all pawns of the same color on // the adjacent files and cannot safely advance. diff --cc src/position.cpp index 996ad30,40ebb95..5b7be11 --- a/src/position.cpp +++ b/src/position.cpp @@@ -477,11 -302,11 +477,11 @@@ void Position::set_castling_right(Colo castlingRightsMask[rfrom] |= cr; castlingRookSquare[cr] = rfrom; - Square kto = relative_square(c, cr & KING_SIDE ? SQ_G1 : SQ_C1); - Square rto = relative_square(c, cr & KING_SIDE ? SQ_F1 : SQ_D1); + Square kto = make_square(cr & KING_SIDE ? castling_kingside_file() : castling_queenside_file(), castling_rank(c)); + Square rto = kto + (cr & KING_SIDE ? WEST : EAST); castlingPath[cr] = (between_bb(rfrom, rto) | between_bb(kfrom, kto) | rto | kto) - & ~(square_bb(kfrom) | rfrom); + & ~(kfrom | rfrom); } diff --cc src/search.cpp index 81ac978,7f29f77..e8461f0 --- a/src/search.cpp +++ b/src/search.cpp @@@ -1254,8 -1170,7 +1254,8 @@@ moves_loop: // When in check, search st || moveCountPruning || ss->staticEval + PieceValue[EG][pos.captured_piece()] <= alpha || cutNode - || thisThread->ttHitAverage < 375 * ttHitAverageResolution * ttHitAverageWindow / 1024) - || thisThread->ttHitAverage < 375 * TtHitAverageResolution * TtHitAverageWindow / 1024)) ++ || thisThread->ttHitAverage < 375 * TtHitAverageResolution * TtHitAverageWindow / 1024) + && !(pos.must_capture() && MoveList(pos).size())) { Depth r = reduction(improving, depth, moveCount);