本文整理汇总了C++中Statistic::increaseOneMove方法的典型用法代码示例。如果您正苦于以下问题:C++ Statistic::increaseOneMove方法的具体用法?C++ Statistic::increaseOneMove怎么用?C++ Statistic::increaseOneMove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Statistic
的用法示例。
在下文中一共展示了Statistic::increaseOneMove方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[])
{
if(argc == 1) {
cerr << "usage: play_game rounds [other arguments which your AI needs]" << endl;
return 1;
}
int iPlayRounds = atoi(argv[1]);
// create and initialize AI
Fib2584Ai ai;
ai.initialize(argc, argv);
// initialize statistic data
Statistic statistic;
statistic.setStartTime();
// play each round
for(int i = 0;i < iPlayRounds;i++) {
GameBoard gameBoard;
gameBoard.initialize();
int iScore = 0;
int arrayBoard[4][4];
while(!gameBoard.terminated()) {
gameBoard.getArrayBoard(arrayBoard);
MoveDirection moveDirection = ai.generateMove(arrayBoard);
GameBoard originalBoard = gameBoard;
iScore += gameBoard.move(moveDirection);
if(originalBoard == gameBoard) {
printf("Repeated\n");
exit(1);
}
statistic.increaseOneMove();
gameBoard.addRandomTile();
}
gameBoard.getArrayBoard(arrayBoard);
ai.gameOver(arrayBoard, iScore);
statistic.increaseOneGame();
// update statistic data
statistic.updateScore(iScore);
statistic.updateMaxTile(gameBoard.getMaxTile());
}
statistic.setFinishTime();
// output statistic data
statistic.show();
return 0;
}