本文整理汇总了C#中Skill.enabled方法的典型用法代码示例。如果您正苦于以下问题:C# Skill.enabled方法的具体用法?C# Skill.enabled怎么用?C# Skill.enabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Skill
的用法示例。
在下文中一共展示了Skill.enabled方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: id_loop
// id_loop() is the main iterative deepening loop. It calls search() repeatedly
// with increasing depth until the allocated thinking time has been consumed,
// user stops the search, or the maximum search depth is reached.
private static void id_loop(Position pos)
{
var stack = new Stack[_.MAX_PLY + 4];
for (var idx = 0; idx < stack.Length; idx++)
{
stack[idx] = new Stack();
}
var ss = new StackArrayWrapper(stack, 2); // To allow referencing (ss-2) and (ss+2)
ValueT alpha, delta;
var easyMove = EasyMove.get(pos.key());
EasyMove.clear();
//TODO: need to memset?
//Math.Memset(ss - 2, 0, 5 * sizeof(Stack));
var depth = Depth.DEPTH_ZERO;
BestMoveChanges = 0;
var bestValue = delta = alpha = -Value.VALUE_INFINITE;
var beta = Value.VALUE_INFINITE;
TranspositionTable.new_search();
var multiPV = uint.Parse(OptionMap.Instance["MultiPV"].v);
var skill = new Skill(int.Parse(OptionMap.Instance["Skill Level"].v));
// When playing with strength handicap enable MultiPV search that we will
// use behind the scenes to retrieve a set of possible moves.
if (skill.enabled())
{
multiPV = Math.Max(multiPV, 4);
multiPV = Math.Max(multiPV, 4);
multiPV = Math.Max(multiPV, 4);
}
multiPV = (uint) Math.Min(multiPV, RootMoves.Count);
// Iterative deepening loop until requested to stop or target depth reached;
while (++depth < _.MAX_PLY && !Signals.stop && (Limits.depth == 0 || depth <= Limits.depth))
{
// Age out PV variability metric
BestMoveChanges *= 0.5;
// Save the last iteration's scores before first PV line is searched and
// all the move scores except the (new) PV are set to -VALUE_INFINITE.
foreach (var rm in RootMoves)
{
rm.previousScore = rm.score;
}
// MultiPV loop. We perform a full root search for each PV line
for (PVIdx = 0; PVIdx < multiPV && !Signals.stop; ++PVIdx)
{
// Reset aspiration window starting size
if (depth >= 5*Depth.ONE_PLY_C)
{
delta = Value.Create(16);
alpha = Value.Create(Math.Max(RootMoves[(int) PVIdx].previousScore - delta, -Value.VALUE_INFINITE));
beta = Value.Create(Math.Min(RootMoves[(int) PVIdx].previousScore + delta, Value.VALUE_INFINITE));
}
// Start with a small aspiration window and, in the case of a fail
// high/low, re-search with a bigger window until we're not failing
// high/low anymore.
while (true)
{
bestValue = search(NodeType.Root, false, pos, ss, alpha, beta, depth, false);
// Bring the best move to the front. It is critical that sorting
// is done with a stable algorithm because all the values but the
// first and eventually the new best one are set to -VALUE_INFINITE
// and we want to keep the same order for all the moves except the
// new PV that goes to the front. Note that in case of MultiPV
// search the already searched PV lines are preserved.
//TODO: Check for stable sort replacement
Utils.stable_sort(RootMoves, (int) PVIdx, RootMoves.Count);
//std::stable_sort(RootMoves.begin() + PVIdx, RootMoves.end());
// Write PV back to transposition table in case the relevant
// entries have been overwritten during the search.
for (var i = 0; i <= PVIdx; ++i)
{
RootMoves[i].insert_pv_in_tt(pos);
}
// If search has been stopped break immediately. Sorting and
// writing PV back to TT is safe because RootMoves is still
// valid, although it refers to previous iteration.
if (Signals.stop)
{
break;
}
//.........这里部分代码省略.........