当前位置: 首页>>代码示例>>C++>>正文


C++ Evaluator::score方法代码示例

本文整理汇总了C++中Evaluator::score方法的典型用法代码示例。如果您正苦于以下问题:C++ Evaluator::score方法的具体用法?C++ Evaluator::score怎么用?C++ Evaluator::score使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Evaluator的用法示例。


在下文中一共展示了Evaluator::score方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main2

int main2() {
	char res[50];
	board b;
	Evaluator e;
	ChessEngine ce;
	int xforce=1;

	int engineplay = 0;
	bitmove m;

	for (;;) {
		if (!xforce && ((b.moveof == white && engineplay == PLAYWHITE)
				|| (b.moveof == black && engineplay == PLAYBLACK))) {
			ce.think(&b, m);
			b.domove(m);
			cout << "move " << m << endl;
		}
		cin.getline(res, 500);
		if (!strcmp(res, "q") || !strcmp(res, "quit"))
			break;
		else if (!strcmp(res, "xboard")) {
			// started by WinBoard
		}else if (!strncmp(res, "protover", 8)) {
			cout << "feature myname=\""
					<< ENGINEFULLNAME<<"\" time=0 reuse=0 analyze=0 done=1\n";
			cout.flush();
		} else if (!strcmp(res, "random")) {
			// ignore random command
		} else if (!strncmp(res, "level", 5)) {
			//Set time controls. need to parse.
		} else if (!strcmp(res, "hard")) {
			//Turn on pondering (thinking on the opponent's time,
			//also known as "permanent brain").
		} else if (!strncmp(res, "time", 4)) {
			//Set a clock that always belongs to the engine.
		} else if (!strncmp(res, "otim", 4)) {
			//Set a clock that always belongs to the opponent.
		} else if (!strcmp(res, "post")) {
			//Turn on thinking/pondering output.
		} else if (!strcmp(res, "black")) {
			engineplay = PLAYBLACK;
            xforce = 1;
		} else if (!strcmp(res, "white")) {
			engineplay = PLAYWHITE;
            xforce = 1;
		} else if (!strcmp(res, "force")) {
			/* Set the engine to play neither color ("force mode").
			 * Stop clocks.
			 * The engine should check that moves received in force mode are
			 * legal and made in the proper turn, but should not think,
			 * ponder, or make moves of its own.
			 */
			engineplay = 0;
            xforce = 1;
		} else if (!strcmp(res, "go")) {
			/*
			 * Leave force mode and set the engine to play the color that is on move.
			 * Associate the engine's clock with the color that is on move,
			 * the opponent's clock with the color that is not on move.
			 * Start the engine's clock.
			 * Start thinking and eventually make a move.
			 */
			engineplay = (b.moveof == white ? PLAYWHITE : PLAYBLACK);
            xforce = 0;
		} else if (!strcmp(res, "new")) {
			/*
			 * Reset the board to the standard chess starting position.
			 * Set White on move.
			 * Leave force mode and set the engine to play Black.
			 */
			b.newgame();
            engineplay = PLAYBLACK;
            xforce = 0;
		} else if (!strncmp(res, "accepted", 8)) {
			// features accepted
		} else if (!strcmp(res, "u") || !strcmp(res, "undo"))
			b.undolastmove();
		else if (!strcmp(res, "l") || !strcmp(res, "list"))
			generateAndListMoves(b);
		else if (!strcmp(res, "e") || !strcmp(res, "evaluate"))
			cout << "Score: " << e.score(b) << endl;
		else if (!strcmp(res, "t") || !strcmp(res, "think")) {
			ce.think(&b, m);
			b.domove(m);
		} else if (m.set(res)) {
			b.domove(m);
		} else
			cout << "Illigal move: "<<res<<endl;;
	}
	return 1;
}
开发者ID:aole,项目名称:evolchess,代码行数:91,代码来源:test.cpp


注:本文中的Evaluator::score方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。