本文整理汇总了C#中Portfish.Position.is_passed_pawn_push方法的典型用法代码示例。如果您正苦于以下问题:C# Position.is_passed_pawn_push方法的具体用法?C# Position.is_passed_pawn_push怎么用?C# Position.is_passed_pawn_push使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Portfish.Position
的用法示例。
在下文中一共展示了Position.is_passed_pawn_push方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: connected_threat
// connected_threat() tests whether it is safe to forward prune a move or if
// is somehow connected to the threat move returned by null search.
static bool connected_threat(Position pos, Move m, Move threat)
{
Debug.Assert(Utils.is_ok_M(m));
Debug.Assert(Utils.is_ok_M(threat));
Debug.Assert(!pos.is_capture_or_promotion(m));
Debug.Assert(!pos.is_passed_pawn_push(m));
Square mfrom, mto, tfrom, tto;
mfrom = Utils.from_sq(m);
mto = Utils.to_sq(m);
tfrom = Utils.from_sq(threat);
tto = Utils.to_sq(threat);
// Case 1: Don't prune moves which move the threatened piece
if (mfrom == tto)
return true;
// Case 2: If the threatened piece has value less than or equal to the
// value of the threatening piece, don't prune moves which defend it.
if (pos.is_capture(threat)
&& (Position.PieceValueMidgame[pos.piece_on(tfrom)] >= Position.PieceValueMidgame[pos.piece_on(tto)]
|| Utils.type_of(pos.piece_on(tfrom)) == PieceTypeC.KING)
&& pos.move_attacks_square(m, tto))
return true;
// Case 3: If the moving piece in the threatened move is a slider, don't
// prune safe moves which block its ray.
if (piece_is_slider(pos.piece_on(tfrom))
&& (Utils.bit_is_set(Utils.between_bb(tfrom, tto), mto) != 0)
&& pos.see(m, true) >= 0)
return true;
return false;
}
示例2: search
//.........这里部分代码省略.........
continue;
}
moveCount = ++sp.moveCount;
ThreadHelper.lock_release(sp.Lock);
}
else
{
moveCount++;
}
if (RootNode)
{
SignalsFirstRootMove = (moveCount == 1);
if (thisThread == Threads.main_thread() && SearchTime.ElapsedMilliseconds > 3000)
{
Plug.Write("info depth ");
Plug.Write((depth / DepthC.ONE_PLY).ToString());
Plug.Write(" currmove ");
Plug.Write(Utils.move_to_uci(move, pos.chess960));
Plug.Write(" nodes ");
Plug.Write(pos.nodes.ToString());
Plug.Write(" currmovenumber ");
Plug.Write((moveCount + PVIdx).ToString());
Plug.Write(Constants.endl);
}
}
ext = DepthC.DEPTH_ZERO;
captureOrPromotion = pos.is_capture_or_promotion(move);
givesCheck = pos.move_gives_check(move, ci);
dangerous = givesCheck
|| pos.is_passed_pawn_push(move)
|| Utils.type_of_move(move) == MoveTypeC.CASTLING
|| (captureOrPromotion // Entering a pawn endgame?
&& Utils.type_of(pos.piece_on(Utils.to_sq(move))) != PieceTypeC.PAWN
&& Utils.type_of_move(move) == MoveTypeC.NORMAL
&& (pos.non_pawn_material(ColorC.WHITE) + pos.non_pawn_material(ColorC.BLACK)
- Position.PieceValue[PhaseC.MG][pos.piece_on(Utils.to_sq(move))] == ValueC.VALUE_ZERO));
// Step 12. Extend checks and, in PV nodes, also dangerous moves
if (PvNode && dangerous)
{
ext = DepthC.ONE_PLY;
}
// else if (threatExtension && refutes(pos, move, threatMove))
// {
// ext = DepthC.ONE_PLY;
// }
else if (givesCheck && pos.see(move, true) >= 0)
{
ext = DepthC.ONE_PLY / 2;
}
// Singular extension search. If all moves but one fail low on a search of
// (alpha-s, beta-s), and just one fails high on (alpha, beta), then that move
// is singular and should be extended. To verify this we do a reduced search
// on all the other moves but the ttMove, if result is lower than ttValue minus
// a margin then we extend ttreMove.
if (singularExtensionNode && move == ttMove && (ext == 0) && pos.pl_move_is_legal(move, ci.pinned))
{
Debug.Assert(ttValue != ValueC.VALUE_NONE);
var rBeta = ttValue - depth;
ss[ssPos].excludedMove = move;
示例3: qsearch
//.........这里部分代码省略.........
}
if (PvNode && bestValue > alpha)
alpha = bestValue;
futilityBase = ss[ssPos].eval + evalMargin + FutilityMarginQS;
enoughMaterial = (pos.sideToMove == 0 ? pos.st.npMaterialWHITE : pos.st.npMaterialBLACK) > Constants.RookValueMidgame;
}
// Initialize a MovePicker object for the current position, and prepare
// to search the moves. Because the depth is <= 0 here, only captures,
// queen promotions and checks (only if depth >= DEPTH_QS_CHECKS) will
// be generated.
MovePicker mp = MovePickerBroker.GetObject();
mp.MovePickerC(pos, ttMove, depth, H, (ss[ssPos - 1].currentMove) & 0x3F);
CheckInfo ci = CheckInfoBroker.GetObject();
ci.CreateCheckInfo(pos);
// Loop through the moves until no moves remain or a beta cutoff occurs
while (bestValue < beta
&& (move = mp.next_move()) != MoveC.MOVE_NONE)
{
Debug.Assert(Utils.is_ok_M(move));
givesCheck = pos.move_gives_check(move, ci);
// Futility pruning
if (!PvNode
&& !inCheck
&& !givesCheck
&& move != ttMove
&& enoughMaterial
&& ((move & (3 << 14)) != (1 << 14))
&& !pos.is_passed_pawn_push(move))
{
futilityValue = futilityBase
+ Position.PieceValueEndgame[pos.board[move & 0x3F]]
+ (((move & (3 << 14)) == (2 << 14)) ? Constants.PawnValueEndgame : ValueC.VALUE_ZERO);
if (futilityValue < beta)
{
if (futilityValue > bestValue)
bestValue = futilityValue;
continue;
}
// Prune moves with negative or equal SEE
if (futilityBase < beta
&& depth < DepthC.DEPTH_ZERO
&& pos.see(move, false) <= 0)
continue;
}
// Detect non-capture evasions that are candidate to be pruned
evasionPrunable = !PvNode
&& inCheck
&& bestValue > ValueC.VALUE_MATED_IN_MAX_PLY
&& !(((pos.board[move & 0x3F] != PieceC.NO_PIECE) && !((move & (3 << 14)) == (3 << 14))) || ((move & (3 << 14)) == (2 << 14)))
&& ((pos.st.castleRights & (CastleRightC.WHITE_ANY << (pos.sideToMove << 1))) == 0);
// Don't search moves with negative SEE values
if (!PvNode
&& move != ttMove
&& (!inCheck || evasionPrunable)
&& (move & (3 << 14)) != (1 << 14)
示例4: qsearch
//.........这里部分代码省略.........
if (PvNode && bestValue > alpha)
{
alpha = bestValue;
}
futilityBase = ss[ssPos].staticEval + ss[ssPos].evalMargin + 128;
enoughMaterial = (pos.sideToMove == 0 ? pos.st.npMaterialWHITE : pos.st.npMaterialBLACK)
> Constants.RookValueMidgame;
}
// Initialize a MovePicker object for the current position, and prepare
// to search the moves. Because the depth is <= 0 here, only captures,
// queen promotions and checks (only if depth >= DEPTH_QS_CHECKS) will
// be generated.
var mp = MovePickerBroker.GetObject();
mp.MovePickerC(pos, ttMove, depth, H, (ss[ssPos - 1].currentMove) & 0x3F);
var ci = CheckInfoBroker.GetObject();
ci.CreateCheckInfo(pos);
// Loop through the moves until no moves remain or a beta cutoff occurs
while ((move = mp.next_move()) != MoveC.MOVE_NONE)
{
Debug.Assert(Utils.is_ok_M(move));
givesCheck = pos.move_gives_check(move, ci);
// Futility pruning
if (!PvNode
&& !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