本文整理汇总了C#中Portfish.Position.can_castle_C方法的典型用法代码示例。如果您正苦于以下问题:C# Position.can_castle_C方法的具体用法?C# Position.can_castle_C怎么用?C# Position.can_castle_C使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Portfish.Position
的用法示例。
在下文中一共展示了Position.can_castle_C方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: qsearch
//.........这里部分代码省略.........
&& !InCheck
&& !givesCheck
&& !fromNull
&& move != ttMove
&& enoughMaterial
&& Utils.type_of_move(move) != MoveTypeC.PROMOTION && !pos.is_passed_pawn_push(move))
{
futilityValue = futilityBase + Position.PieceValue[PhaseC.EG][pos.board[move & 0x3F]]
+ (Utils.type_of_move(move) == MoveTypeC.ENPASSANT
? Constants.PawnValueEndgame
: ValueC.VALUE_ZERO);
if (futilityValue < beta)
{
bestValue = Math.Max(bestValue, futilityValue);
continue;
}
// Prune moves with negative or equal SEE
if (futilityBase < beta
&& depth < DepthC.DEPTH_ZERO
&& pos.see(move, false) <= 0)
{
bestValue = Math.Max(bestValue, futilityBase);
continue;
}
}
// Detect non-capture evasions that are candidate to be pruned
evasionPrunable = !PvNode
&& InCheck
&& bestValue > ValueC.VALUE_MATED_IN_MAX_PLY
&& !pos.is_capture(move)
&& (pos.can_castle_C(pos.sideToMove) == 0);
// Don't search moves with negative SEE values
if (!PvNode
&& move != ttMove
&& (!InCheck || evasionPrunable)
&& Utils.type_of_move(move) != MoveTypeC.PROMOTION
&& pos.see(move, true) < 0)
{
continue;
}
// Don't search useless checks
if (!PvNode
&& !InCheck
&& givesCheck
&& move != ttMove
&& !pos.is_capture_or_promotion(move)
&& ss[ssPos].staticEval + Constants.PawnValueMidgame / 4 < beta
&& !check_is_dangerous(pos, move, futilityBase, beta))
{
continue;
}
// Check for legality only before to do the move
if (!pos.pl_move_is_legal(move, ci.pinned))
{
continue;
}
ss[ssPos].currentMove = move;
// Make and search the move
示例2: generate_all
private static void generate_all(
GenType type,
Position pos,
MoveStack[] mlist,
ref int mpos,
int us,
ulong target,
CheckInfo ci)
{
var Checks = type == GenType.QUIET_CHECKS;
generate_pawn_moves(us, type, pos, mlist, ref mpos, target, ci);
generate_moves(PieceTypeC.KNIGHT, Checks, pos, mlist, ref mpos, us, target, ci);
generate_moves(PieceTypeC.BISHOP, Checks, pos, mlist, ref mpos, us, target, ci);
generate_moves(PieceTypeC.ROOK, Checks, pos, mlist, ref mpos, us, target, ci);
generate_moves(PieceTypeC.QUEEN, Checks, pos, mlist, ref mpos, us, target, ci);
if (!Checks && type != GenType.EVASIONS)
{
Square from = pos.king_square(us);
Bitboard b = Position.attacks_from_KING(from) & target;
// SERIALIZE(b);
while (b != 0)
{
#if X64
Bitboard bb = b;
b &= (b - 1);
mlist[mpos++].move = ((Utils.BSFTable[((bb & (0xffffffffffffffff - bb + 1)) * DeBruijn_64) >> 58]) | (from << 6));
#else
mlist[mpos++].move = Utils.make_move(from, Utils.pop_lsb(ref b));
#endif
}
}
if (type != GenType.CAPTURES && type != GenType.EVASIONS && pos.can_castle_C(us) != 0)
{
generate_castle(CastlingSideC.KING_SIDE, Checks, pos, mlist, ref mpos, us);
generate_castle(CastlingSideC.QUEEN_SIDE, Checks, pos, mlist, ref mpos, us);
}
}
示例3: generate_quiet_check
internal static void generate_quiet_check(Position pos, MoveStack[] ms, ref int mpos)
{
/// generate<MV_NON_CAPTURE_CHECK> generates all pseudo-legal non-captures and knight
/// underpromotions that give check. Returns a pointer to the end of the move list.
Debug.Assert(!pos.in_check());
Color us = pos.sideToMove;
CheckInfo ci = CheckInfoBroker.GetObject();
ci.CreateCheckInfo(pos);
Bitboard dc = ci.dcCandidates;
while (dc != 0)
{
Square from = Utils.pop_1st_bit(ref dc);
PieceType pt = Utils.type_of(pos.piece_on(from));
if (pt == PieceTypeC.PAWN)
continue; // Will be generated together with direct checks
Bitboard b = pos.attacks_from_PTS(pt, from) & ~pos.occupied_squares;
if (pt == PieceTypeC.KING)
b &= ~Utils.PseudoAttacks[PieceTypeC.QUEEN][ci.ksq];
while (b != 0) { ms[mpos++].move = Utils.make_move(from, Utils.pop_1st_bit(ref b)); }
}
generate_pawn_moves(us, MoveType.MV_QUIET_CHECK, pos, ms, ref mpos, ci.dcCandidates, ci.ksq);
generate_direct_checks(PieceTypeC.KNIGHT, pos, ms, ref mpos, us, ci);
generate_direct_checks(PieceTypeC.BISHOP, pos, ms, ref mpos, us, ci);
generate_direct_checks(PieceTypeC.ROOK, pos, ms, ref mpos, us, ci);
generate_direct_checks(PieceTypeC.QUEEN, pos, ms, ref mpos, us, ci);
if (pos.can_castle_C(us) != 0)
{
generate_castle(CastlingSideC.KING_SIDE, true, pos, ms, ref mpos, us);
generate_castle(CastlingSideC.QUEEN_SIDE, true, pos, ms, ref mpos, us);
}
CheckInfoBroker.Free();
}