本文整理汇总了C#中System.Clock.Stop方法的典型用法代码示例。如果您正苦于以下问题:C# Clock.Stop方法的具体用法?C# Clock.Stop怎么用?C# Clock.Stop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Clock
的用法示例。
在下文中一共展示了Clock.Stop方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Search
public override SearchResult Search(Board board, int color,int depth)
{
SearchResult searchResult = new SearchResult();
//board.CurrentColor = color;
//PrepareToSolve(board);
int alpha = -MaxScore - 1;
int beta = MaxScore + 1;
int opp = color.Opp();
Clock clock = new Clock();
clock.Start();
//Roulette roulette = new Roulette();
//board.RefreshHash();
int score = -MaxScore;
int eval;
//是否调用零窗口的标志
bool foundPv = false;
var moves = rule.FindFlips(board, color).ToList();
if (moves.Count == 0) {
return new SearchResult() { Move = -1 };
}
//if (moves.Count == 1) {
// return new SearchResult() { Move = moves.First().Pos };
//}
for (int i = 0; i < moves.Count; i++) {
var pos = moves[i].Pos;
//下棋
//---------------------------
int flipCount = board.MakeMove(pos, color);
searchResult.Nodes++;
//检测
if (foundPv) {
//调用零窗口
eval = -FastestFirstSolve(board, -alpha - 1, -alpha, depth - 1, searchResult, opp, color);
if ((eval > alpha) && (eval < beta)) {
eval = -FastestFirstSolve(board, -beta, -eval, depth - 1, searchResult, opp, color);
//eval = -FastestFirstMidSolve( -beta, -alpha, oppcolor, depth - 1);
}
}
else {
eval = -FastestFirstSolve(board, -beta, -alpha, depth - 1, searchResult, opp, color);
}
//em.ReLink();
//---------------------------
//Eval.StepsPop(color);
//恢复到上一步
board.Reback(pos, flipCount, opp);
searchResult.Message += string.Format("({0}:{1})", pos, eval);
if (eval > score) {
score = eval;
//更新位置
searchResult.Move = pos;
searchResult.Score = score;
if (eval > alpha) {
if (eval >= beta) {
//剪枝
break;
}
alpha = eval;
foundPv = true;
}
}
}
clock.Stop();
searchResult.TimeSpan = clock.Elapsed;
return searchResult;
}