+ st->checkersBB = attacks_to(king_square(us), opposite_color(us));
+}
+
+/// Position:find_hidden_checks() computes the pinned, pinners and dcCandidates
+/// bitboards. There are two versions of this function. One takes a color and
+/// computes bitboards relative to that color only, the other computes both
+/// colors. Bitboard checkersBB must be already updated.
+
+void Position::find_hidden_checks(Color us, unsigned int types) {
+
+ Bitboard p1, p2;
+ Color them = opposite_color(us);
+ Square ksq = king_square(them);
+ if (types & Pinned)
+ {
+ st->pinned[them] = hidden_checks<ROOK, true>(them, ksq, p1) | hidden_checks<BISHOP, true>(them, ksq, p2);
+ st->pinners[them] = p1 | p2;
+ }
+ if (types & DcCandidates)
+ st->dcCandidates[us] = hidden_checks<ROOK, false>(us, ksq, p1) | hidden_checks<BISHOP, false>(us, ksq, p2);
+}
+
+void Position::find_hidden_checks() {
+
+ for (Color c = WHITE; c <= BLACK; c++)
+ find_hidden_checks(c, Pinned | DcCandidates);