void DirecDiagNESW::Do2Move(Position& position, Square from, const Square ksq, const Color us) const {
	const PieceTypeEvent ptEvent1(position.GetOccupiedBB(), Color::Null, ksq);
	position.GetStateInfo()->m_checkersBB |=
		PiecetypePrograms::m_BISHOP.GetAttacks2From(ptEvent1) &
		(
			us == Color::Black
			?
			position.GetBbOf30<Color::Black>(PieceType::N05_Bishop, PieceType::N13_Horse)
			:
			position.GetBbOf30<Color::White>(PieceType::N05_Bishop, PieceType::N13_Horse)
			)
		;
}
Ejemplo n.º 2
0
Key Book::GetBookKey(const Position& pos) {
	Key key = 0;
	Bitboard bb = pos.GetOccupiedBB();

	while (bb.Exists1Bit()) {
		const Square sq = bb.PopFirstOneFromI9();
		key ^= m_ZobPiece[pos.GetPiece(sq)][sq];
	}
	const Hand hand = pos.GetHand(pos.GetTurn());
	for (HandPiece hp = HPawn; hp < HandPieceNum; ++hp) {
		key ^= m_ZobHand[hp][hand.NumOf(hp)];
	}
	if (pos.GetTurn() == White) {
		key ^= m_ZobTurn;
	}
	return key;
}