本文整理汇总了C#中Search.scoreMoveList方法的典型用法代码示例。如果您正苦于以下问题:C# Search.scoreMoveList方法的具体用法?C# Search.scoreMoveList怎么用?C# Search.scoreMoveList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Search
的用法示例。
在下文中一共展示了Search.scoreMoveList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getCommand
public string getCommand(Position pos, bool drawOffer, List<Position> history)
{
// Create a search object
ulong[] posHashList = new ulong[200 + history.Count];
int posHashListSize = 0;
for(int i=0;i<history.Count;i++)
{
Position p = history[i];
posHashList[posHashListSize++] = p.zobristHash();
}
tt.nextGeneration();
Search sc = new Search(pos, posHashList, posHashListSize, tt);
// Determine all legal moves
MoveGen.MoveList moves = new MoveGen().pseudoLegalMoves(pos);
MoveGen.RemoveIllegal(pos, moves);
sc.scoreMoveList(moves, 0);
// Test for "game over"
if (moves.size == 0) {
// Switch sides so that the human can decide what to do next.
return "swap";
}
if (bookEnabled) {
Move bookMove = book.getBookMove(pos);
if (bookMove != null) {
SystemHelper.printf("Book moves: " + book.getAllBookMoves(pos));
return TextIO.moveTostring(pos, bookMove, true);
}
}
// Find best move using iterative deepening
currentSearch = sc;
sc.setListener(listener);
Move bestM;
if ((moves.size == 1) && (canClaimDraw(pos, posHashList, posHashListSize, moves.m[0]) == "")) {
bestM = moves.m[0];
bestM.score = 0;
} else if (randomMode) {
bestM = findSemiRandomMove(sc, moves);
} else {
sc.timeLimit(minTimeMillis, maxTimeMillis);
bestM = sc.iterativeDeepening(moves, maxDepth, maxNodes, verbose);
}
currentSearch = null;
// tt.printStats();
string strMove = TextIO.moveTostring(pos, bestM, true);
bestmv = bestM;
// Claim draw if appropriate
if (bestM.score <= 0) {
string drawClaim = canClaimDraw(pos, posHashList, posHashListSize, bestM);
if (drawClaim != "")
strMove = drawClaim;
}
return strMove;
}
示例2: searchPosition
/** Search a position and return the best move and score. Used for test suite processing. */
public TwoReturnValues<Move, string> searchPosition(Position pos, int maxTimeMillis)
{
// Create a search object
ulong[] posHashList = new ulong[200];
tt.nextGeneration();
Search sc = new Search(pos, posHashList, 0, tt);
// Determine all legal moves
MoveGen.MoveList moves = new MoveGen().pseudoLegalMoves(pos);
MoveGen.RemoveIllegal(pos, moves);
sc.scoreMoveList(moves, 0);
// Find best move using iterative deepening
sc.timeLimit(maxTimeMillis, maxTimeMillis);
Move bestM = sc.iterativeDeepening(moves, -1, -1, false);
// Extract PV
string PV = TextIO.moveTostring(pos, bestM, false) + " ";
UndoInfo ui = new UndoInfo();
pos.makeMove(bestM, ui);
PV += tt.extractPV(pos);
pos.unMakeMove(bestM, ui);
// tt.printStats();
// Return best move and PV
return new TwoReturnValues<Move, string>(bestM, PV);
}