refactor: options 改名为 gameOptions

This commit is contained in:
Calcitem 2019-11-18 00:48:11 +08:00
parent 929d62e7ce
commit 127b5b95b2
5 changed files with 10 additions and 10 deletions

View File

@ -364,7 +364,7 @@ void MoveList::shuffle()
}
if (options.getRandomMoveEnabled()) {
if (gameOptions.getRandomMoveEnabled()) {
uint32_t seed = static_cast<uint32_t>(now());
std::shuffle(movePriorityTable0.begin(), movePriorityTable0.end(), std::default_random_engine(seed));

View File

@ -1033,7 +1033,7 @@ const char* AIAlgorithm::bestMove()
#endif /* ENDGAME_LEARNING */
// 检查是否必败
if (options.getGiveUpIfMostLose() == true) {
if (gameOptions.getGiveUpIfMostLose() == true) {
bool isMostLose = true; // 是否必败
for (int j = 0; j < root->childrenSize; j++) {

View File

@ -19,7 +19,7 @@
#include "option.h"
Options options;
Options gameOptions;
void Options::setAutoRestart(bool enabled)
{

View File

@ -52,6 +52,6 @@ private:
bool learnEndgame { false };
};
extern Options options;
extern Options gameOptions;
#endif /* OPTION_H */

View File

@ -172,7 +172,7 @@ void GameController::gameReset()
tempGame = game;
// 停掉线程
if (!options.getAutoRestart()) {
if (!gameOptions.getAutoRestart()) {
aiThread[BLACK]->stop();
aiThread[WHITE]->stop();
isAiPlayer[BLACK] = false;
@ -405,22 +405,22 @@ void GameController::playSound(const QString &soundPath)
void GameController::setGiveUpIfMostLose(bool enabled)
{
options.setGiveUpIfMostLose(enabled);
gameOptions.setGiveUpIfMostLose(enabled);
}
void GameController::setAutoRestart(bool enabled)
{
options.setAutoRestart(enabled);
gameOptions.setAutoRestart(enabled);
}
void GameController::setRandomMove(bool enabled)
{
options.setRandomMoveEnabled(enabled);
gameOptions.setRandomMoveEnabled(enabled);
}
void GameController::setLearnEndgame(bool enabled)
{
options.setLearnEndgameEnabled(enabled);
gameOptions.setLearnEndgameEnabled(enabled);
}
// 上下翻转
@ -1005,7 +1005,7 @@ bool GameController::command(const QString &cmd, bool update /* = true */)
(aiThread[BLACK]->ai.hashHitCount + aiThread[WHITE]->ai.hashHitCount ) * 100 / (hashProbeCount_1 + hashProbeCount_2));
#endif // TRANSPOSITION_TABLE_DEBUG
if (options.getAutoRestart()) {
if (gameOptions.getAutoRestart()) {
gameReset();
gameStart();