本文整理汇总了C#中Position.pinned_pieces方法的典型用法代码示例。如果您正苦于以下问题:C# Position.pinned_pieces方法的具体用法?C# Position.pinned_pieces怎么用?C# Position.pinned_pieces使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Position
的用法示例。
在下文中一共展示了Position.pinned_pieces方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckInfo
internal CheckInfo(Position pos)
{
var them = Color.opposite(pos.side_to_move());
ksq = pos.square(PieceType.KING, them);
pinned = pos.pinned_pieces(pos.side_to_move());
dcCandidates = pos.discovered_check_candidates();
checkSquares[PieceType.PAWN] = pos.attacks_from_PS(PieceType.PAWN, ksq, them);
checkSquares[PieceType.KNIGHT] = pos.attacks_from_PtS(PieceType.KNIGHT, ksq);
checkSquares[PieceType.BISHOP] = pos.attacks_from_PtS(PieceType.BISHOP, ksq);
checkSquares[PieceType.ROOK] = pos.attacks_from_PtS(PieceType.ROOK, ksq);
checkSquares[PieceType.QUEEN] = checkSquares[PieceType.BISHOP] | checkSquares[PieceType.ROOK];
checkSquares[PieceType.KING] = Bitboard.Create(0);
}
示例2: generate_LEGAL
/// generate
/// LEGAL generates all the legal moves in the given position
private static ExtMoveArrayWrapper generate_LEGAL(Position pos, ExtMoveArrayWrapper moveList)
{
var pinned = pos.pinned_pieces(pos.side_to_move());
var ksq = pos.square(PieceType.KING, pos.side_to_move());
var cur = moveList.current;
moveList = pos.checkers() != 0
? generate(GenType.EVASIONS, pos, moveList)
: generate(GenType.NON_EVASIONS, pos, moveList);
while (cur != moveList.current)
{
if ((pinned != 0 || Move.from_sq(moveList[cur]) == ksq || Move.type_of(moveList[cur]) == MoveType.ENPASSANT)
&& !pos.legal(moveList[cur], pinned))
{
for (var idx = cur; idx < moveList.current; idx++)
{
moveList.table[idx] = moveList.table[idx + 1];
}
--moveList;
}
else
{
++cur;
}
}
return moveList;
}
示例3: init_eval_info
// init_eval_info() initializes king bitboards for given color adding
// pawn attacks. To be done at the beginning of the evaluation.
private static void init_eval_info(ColorT Us, Position pos, EvalInfo ei)
{
var Them = (Us == Color.WHITE ? Color.BLACK : Color.WHITE);
var Down = (Us == Color.WHITE ? Square.DELTA_S : Square.DELTA_N);
ei.pinnedPieces[Us] = pos.pinned_pieces(Us);
var b = ei.attackedBy[Them, PieceType.KING] = pos.attacks_from_PtS(PieceType.KING, pos.square(PieceType.KING, Them));
ei.attackedBy[Them, PieceType.ALL_PIECES] |= b;
ei.attackedBy[Us, PieceType.ALL_PIECES] |= ei.attackedBy[Us, PieceType.PAWN] = ei.pi.pawn_attacks(Us);
// Init king safety tables only if we are going to use them
if (pos.non_pawn_material(Us) >= Value.QueenValueMg)
{
ei.kingRing[Them] = b | Bitboard.shift_bb(Down, b);
b &= ei.attackedBy[Us, PieceType.PAWN];
ei.kingAttackersCount[Us] = b!=0 ? Bitcount.popcount_Max15(b) : 0;
ei.kingAdjacentZoneAttacksCount[Us] = ei.kingAttackersWeight[Us] = 0;
}
else
{
ei.kingRing[Them] = Bitboard.Create(0);
ei.kingAttackersCount[Us] = 0;
}
}