本文整理汇总了C++中MoveList::Length方法的典型用法代码示例。如果您正苦于以下问题:C++ MoveList::Length方法的具体用法?C++ MoveList::Length怎么用?C++ MoveList::Length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MoveList
的用法示例。
在下文中一共展示了MoveList::Length方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Expand
// Get RealVal for each Child Node of this leaf;
// If it is a Player-to-Move node get OptVals for each Child;
void BStar::Expand(TreeNode *SelectedNode,int modo)
{
int EsRaiz;
EsRaiz = SelectedNode == TreeNode::GetRootNode();
//PLY ply(0);
//CJugada J;
int NMoves = 0;
bool EvalOpt;
// int StatusEnroque;
// int alpaso;
int TotalNodesPVS = 0;
int fase = 0;
TreeNode *aux;
// it that position a transposition ?
//aux= GetNodeOfFEN(TreeNode::GetRootNode(),SelectedNode->fen);
//if(aux && aux != SelectedNode)
//{
// TransPos++;
// TransPos += aux->SubtreeSize;
//}
ExpandCount++;
TotalExpand++;
if(!EsRaiz && EsRepeticion(SelectedNode))
{
SelectedNode->RealVal = 0;
SelectedNode->OptVal = 0;
SelectedNode->OptPrb = 0;
SelectedNode->PessVal = 0;
SelectedNode->MoveCount = -1;
SelectedNode->SubtreeSize++;
SelectedNode->Stopper = 1;
RecalProb(SelectedNode);
BackupSubtreeSize(SelectedNode);
return;
}
if(SelectedNode->MoveCount != 0) return; // already expanded ?
_Board.LoadFen(SelectedNode->fen);
if(EsRaiz)
{
SelectedNode->Color = _Board.wtm;
SelectedNode->OptVal = UNDEFINED;
SelectedNode->PessVal = -UNDEFINED;
}
SelectedNode->Color = _Board.wtm;
SelectedNode->SubtreeSize = 1;
DepthNode = GetDepth(SelectedNode);
// determinar si necesitamos optvalues
EvalOpt = (SelectedNode->Color == TreeNode::GetRootNode()->Color);
UndoData undo;
MoveList List;
int Move;
int i;
_Board.GenPseudoMoves(List);
for(i = 0; i < List.Length();i++)
{
Move = List.Move(i);
_Board.DoMove(Move,undo);
// Test legality
if(_Board.IsLegal())
{
// agregamos un nodo.
aux = TreeNode::GetFree();
aux->Color = _Board.wtm;
aux->Stopper = 0;
aux->Move = Move;
_Board.MoveToAlgebra(Move,aux->MoveStr);
aux->Flags = Normal;
if(undo.capture || undo.IsPromote)
aux->Flags = Capture;
else
if(_Board.IsCheck())
aux->Flags = InCheck;
assert(aux->OptVal <= UNDEFINED);
assert(aux->PessVal <= UNDEFINED);
char dest[100];
_Board.SaveFEN(&dest[0]);
strcpy(aux->fen,dest);
SelectedNode->Add(aux);
NMoves++;
}
_Board.UndoMove(Move,undo);
}
SelectedNode->MoveCount = NMoves;
if(NMoves)
{
int ParamJob = DepthEval;
// segunda fase calculamos el valor real
//.........这里部分代码省略.........