本文整理汇总了C++中Computer::maxSearch方法的典型用法代码示例。如果您正苦于以下问题:C++ Computer::maxSearch方法的具体用法?C++ Computer::maxSearch怎么用?C++ Computer::maxSearch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Computer
的用法示例。
在下文中一共展示了Computer::maxSearch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: func
void func(chessboard *chess, int depth,int turn,Vector2i* bestmove,Vector2i start,Vector2i end)
{
Computer temp;
if(turn==2) //If the computer is playing for player 2 then calling minSearch and trying to find largest value of board for each value returned by minsearch
{
int value = temp.minSearch( depth-1 , *chess ,-INFINITY,INFINITY); //Finding all the minimum values of board
if( value > bestvalue ) //Selecting the best move by finding the maximum of the values obtained
{
bestvalue = value;
bestmove[0].x = start.x;
bestmove[0].y = start.y;
bestmove[1].x = end.x;
bestmove[1].y = end.y;
}
}
else //Opposite of that for player 1
{
int value = temp.maxSearch( depth-1 , *chess,-INFINITY,INFINITY ); //Finds all maximum values of board
if( value < bestvalue ) //Selects the lowest of those values
{
bestvalue = value;
bestmove[0].x = start.x;
bestmove[0].y = start.y;
bestmove[1].x = end.x;
bestmove[1].y = end.y;
}
}
delete chess; //Chess board obtained is deleted as no longer needed
}