Merge official-stockfish/master
authorFabian Fichter <ianfab@users.noreply.github.com>
Sat, 9 Feb 2019 23:44:47 +0000 (00:44 +0100)
committerFabian Fichter <ianfab@users.noreply.github.com>
Sat, 9 Feb 2019 23:44:47 +0000 (00:44 +0100)
bench: 4915605

1  2 
src/evaluate.cpp
src/misc.cpp
src/movepick.h
src/pawns.cpp
src/search.cpp

@@@ -648,20 -538,25 +648,26 @@@ namespace 
          {
              Square s = pop_lsb(&b);
              score += ThreatByMinor[type_of(pos.piece_on(s))];
 -            if (type_of(pos.piece_on(s)) != PAWN)
 -                score += ThreatByRank * (int)relative_rank(Them, s);
++
 +            if (type_of(pos.piece_on(s)) != PAWN && type_of(pos.piece_on(s)) != SHOGI_PAWN)
 +                score += ThreatByRank * (int)relative_rank(Them, s, pos.max_rank());
+             else if (pos.blockers_for_king(Them) & s)
 -                score += ThreatByRank * (int)relative_rank(Them, s) / 2;
++                score += ThreatByRank * (int)relative_rank(Them, s, pos.max_rank()) / 2;
          }
  
-         b = (pos.pieces(Them, QUEEN) | weak) & attackedBy[Us][ROOK];
+         b = weak & attackedBy[Us][ROOK];
          while (b)
          {
              Square s = pop_lsb(&b);
              score += ThreatByRook[type_of(pos.piece_on(s))];
 -            if (type_of(pos.piece_on(s)) != PAWN)
 -                score += ThreatByRank * (int)relative_rank(Them, s);
 +            if (type_of(pos.piece_on(s)) != PAWN && type_of(pos.piece_on(s)) != SHOGI_PAWN)
 +                score += ThreatByRank * (int)relative_rank(Them, s, pos.max_rank());
+             else if (pos.blockers_for_king(Them) & s)
 -                score += ThreatByRank * (int)relative_rank(Them, s) / 2;
++                score += ThreatByRank * (int)relative_rank(Them, s, pos.max_rank()) / 2;
          }
  
-         // Bonus for king attacks on pawns or pieces which are not pawn-defended
          if (weak & attackedBy[Us][KING])
              score += ThreatByKing;
  
diff --cc src/misc.cpp
Simple merge
diff --cc src/movepick.h
@@@ -85,7 -85,7 +85,7 @@@ enum StatsParams { NOT_USED = 0 }
  /// unsuccessful during the current search, and is used for reduction and move
  /// ordering decisions. It uses 2 tables (one for each color) indexed by
  /// the move's from and to squares, see chessprogramming.wikispaces.com/Butterfly+Boards
- typedef Stats<int16_t, 10368, COLOR_NB, int(SQUARE_NB + 1) * int(SQUARE_NB)> ButterflyHistory;
 -typedef Stats<int16_t, 10692, COLOR_NB, int(SQUARE_NB) * int(SQUARE_NB)> ButterflyHistory;
++typedef Stats<int16_t, 10692, COLOR_NB, int(SQUARE_NB + 1) * int(SQUARE_NB)> ButterflyHistory;
  
  /// CounterMoveHistory stores counter moves indexed by [piece][to] of the previous
  /// move, see chessprogramming.wikispaces.com/Countermove+Heuristic
diff --cc src/pawns.cpp
@@@ -233,9 -206,9 +233,9 @@@ Value Entry::evaluate_shelter(const Pos
  
    constexpr Color     Them = (Us == WHITE ? BLACK : WHITE);
    constexpr Direction Down = (Us == WHITE ? SOUTH : NORTH);
 -  constexpr Bitboard  BlockRanks = (Us == WHITE ? Rank1BB | Rank2BB : Rank8BB | Rank7BB);
 +  Bitboard  BlockRanks = rank_bb(relative_rank(Us, RANK_1, pos.max_rank())) | rank_bb(relative_rank(Us, RANK_2, pos.max_rank()));
  
-   Bitboard b = pos.pieces(PAWN, SHOGI_PAWN) & (forward_ranks_bb(Us, ksq) | rank_bb(ksq));
 -  Bitboard b = pos.pieces(PAWN) & ~forward_ranks_bb(Them, ksq);
++  Bitboard b = pos.pieces(PAWN, SHOGI_PAWN) & ~forward_ranks_bb(Them, ksq);
    Bitboard ourPawns = b & pos.pieces(Us);
    Bitboard theirPawns = b & pos.pieces(Them);
  
diff --cc src/search.cpp
Simple merge