本文整理汇总了C#中Position.captured_piece_type方法的典型用法代码示例。如果您正苦于以下问题:C# Position.captured_piece_type方法的具体用法?C# Position.captured_piece_type怎么用?C# Position.captured_piece_type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Position
的用法示例。
在下文中一共展示了Position.captured_piece_type方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: search
//.........这里部分代码省略.........
nullValue = beta;
if (depth < 12*Depth.ONE_PLY && Math.Abs(beta) < Value.VALUE_KNOWN_WIN)
return nullValue;
// Do verification search at high depths
stack.skipEarlyPruning = true;
var v = depth - R < Depth.ONE_PLY
? qsearch(NodeType.NonPV, false, pos, ss, beta - 1, beta, Depth.DEPTH_ZERO)
: search(NodeType.NonPV, false, pos, ss, beta - 1, beta, depth - R, false);
stack.skipEarlyPruning = false;
if (v >= beta)
return nullValue;
}
}
// Step 9. ProbCut (skipped when in check)
// If we have a very good capture (i.e. SEE > seeValues[captured_piece_type])
// and a reduced search returns a value much above beta, we can (almost) safely
// prune the previous move.
if (!PvNode
&& depth >= 5*Depth.ONE_PLY_C
&& Math.Abs(beta) < Value.VALUE_MATE_IN_MAX_PLY)
{
var rbeta = Value.Create(Math.Min(beta + 200, Value.VALUE_INFINITE));
var rdepth = depth - 4*Depth.ONE_PLY;
Debug.Assert(rdepth >= Depth.ONE_PLY_C);
Debug.Assert(stackMinus1.currentMove != Move.MOVE_NONE);
Debug.Assert(stackMinus1.currentMove != Move.MOVE_NULL);
var mp2 = new MovePicker(pos, ttMove, History, CounterMovesHistory,
Value.PieceValue[(int) Phase.MG][pos.captured_piece_type()]);
var ci2 = new CheckInfo(pos);
while ((move = mp2.next_move(false)) != Move.MOVE_NONE)
if (pos.legal(move, ci2.pinned))
{
stack.currentMove = move;
pos.do_move(move, st, pos.gives_check(move, ci2));
value =
-search(NodeType.NonPV, false, pos, new StackArrayWrapper(ss.table, ss.current + 1), -rbeta,
-rbeta + 1, rdepth, !cutNode);
pos.undo_move(move);
if (value >= rbeta)
return value;
}
}
// Step 10. Internal iterative deepening (skipped when in check)
if (depth >= (PvNode ? 5*Depth.ONE_PLY_C : 8*Depth.ONE_PLY_C)
&& ttMove == 0
&& (PvNode || stack.staticEval + 256 >= beta))
{
var d = depth - 2*Depth.ONE_PLY - (PvNode ? Depth.DEPTH_ZERO : depth/4);
stack.skipEarlyPruning = true;
search(PvNode ? NodeType.PV : NodeType.NonPV, false, pos, ss, alpha, beta, d, true);
stack.skipEarlyPruning = false;
tte = TranspositionTable.probe(posKey, out ttHit);
ttMove = ttHit ? tte.move() : Move.MOVE_NONE;
}
moves_loop: // When in check and at SpNode search starts from here
示例2: update_stats
// update_stats() updates killers, history, countermove history and
// countermoves stats for a quiet best move.
private static void update_stats(Position pos, StackArrayWrapper ss, MoveT move,
Depth depth, MoveT[] quiets, int quietsCnt)
{
if (ss[ss.current].killers0 != move)
{
ss[ss.current].killers1 = ss[ss.current].killers0;
ss[ss.current].killers0 = move;
}
var bonus = Value.Create((depth/Depth.ONE_PLY)*(depth/Depth.ONE_PLY));
var prevSq = Move.to_sq(ss[ss.current - 1].currentMove);
var cmh = CounterMovesHistory.table[pos.piece_on(prevSq), prevSq];
History.updateH(pos.moved_piece(move), Move.to_sq(move), bonus);
if (Move.is_ok(ss[ss.current - 1].currentMove))
{
Countermoves.update(pos.piece_on(prevSq), prevSq, move);
cmh.updateCMH(pos.moved_piece(move), Move.to_sq(move), bonus);
}
// Decrease all the other played quiet moves
for (var i = 0; i < quietsCnt; ++i)
{
History.updateH(pos.moved_piece(quiets[i]), Move.to_sq(quiets[i]), -bonus);
if (Move.is_ok(ss[ss.current - 1].currentMove))
cmh.updateCMH(pos.moved_piece(quiets[i]), Move.to_sq(quiets[i]), -bonus);
}
// Extra penalty for PV move in previous ply when it gets refuted
if (Move.is_ok(ss[ss.current - 2].currentMove) && ss[ss.current - 1].moveCount == 1 &&
pos.captured_piece_type()==0)
{
var prevPrevSq = Move.to_sq(ss[ss.current - 2].currentMove);
var ttMoveCmh = CounterMovesHistory.table[pos.piece_on(prevPrevSq), prevPrevSq];
ttMoveCmh.updateCMH(pos.piece_on(prevSq), prevSq, -bonus - 2*depth/Depth.ONE_PLY - 1);
}
}