Change option name to upper camel case style
This commit is contained in:
parent
6a5ff653e1
commit
7172e9bdb2
|
@ -167,17 +167,17 @@ void init(OptionsMap &o)
|
|||
o["Shuffling"] << Option(true, on_random_move);
|
||||
|
||||
// Rules
|
||||
o["piecesCount"] << Option(12, 6, 12, on_piecesCount);
|
||||
o["piecesAtLeastCount"] << Option(3, 3, 5, on_piecesAtLeastCount);
|
||||
o["hasObliqueLines"] << Option(true, on_hasObliqueLines);
|
||||
o["hasBannedLocations"] << Option(true, on_hasBannedLocations);
|
||||
o["isDefenderMoveFirst"] << Option(true, on_isDefenderMoveFirst);
|
||||
o["mayRemoveMultiple"] << Option(false, on_mayRemoveMultiple);
|
||||
o["mayRemoveFromMillsAlways"] << Option(true, on_mayRemoveFromMillsAlways);
|
||||
o["isBlackLoseButNotDrawWhenBoardFull"] << Option(true, on_isBlackLoseButNotDrawWhenBoardFull);
|
||||
o["isLoseButNotChangeSideWhenNoWay"] << Option(true, on_isLoseButNotChangeSideWhenNoWay);
|
||||
o["mayFly"] << Option(false, on_mayFly);
|
||||
o["maxStepsLedToDraw"] << Option(50, 30, 50, on_maxStepsLedToDraw);
|
||||
o["PiecesCount"] << Option(12, 6, 12, on_piecesCount);
|
||||
o["PiecesAtLeastCount"] << Option(3, 3, 5, on_piecesAtLeastCount);
|
||||
o["HasObliqueLines"] << Option(true, on_hasObliqueLines);
|
||||
o["HasBannedLocations"] << Option(true, on_hasBannedLocations);
|
||||
o["IsDefenderMoveFirst"] << Option(true, on_isDefenderMoveFirst);
|
||||
o["MayRemoveMultiple"] << Option(false, on_mayRemoveMultiple);
|
||||
o["MayRemoveFromMillsAlways"] << Option(true, on_mayRemoveFromMillsAlways);
|
||||
o["IsBlackLoseButNotDrawWhenBoardFull"] << Option(true, on_isBlackLoseButNotDrawWhenBoardFull);
|
||||
o["IsLoseButNotChangeSideWhenNoWay"] << Option(true, on_isLoseButNotChangeSideWhenNoWay);
|
||||
o["MayFly"] << Option(false, on_mayFly);
|
||||
o["MaxStepsLedToDraw"] << Option(50, 30, 50, on_maxStepsLedToDraw);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -57,51 +57,51 @@ class Config {
|
|||
static Future<void> loadProfile() async {
|
||||
final profile = await Profile.shared();
|
||||
|
||||
Config.toneEnabled = profile['toneEnabled'] ?? true;
|
||||
Config.thinkingTime = profile['thinkingTime'] ?? 5000;
|
||||
Config.aiMovesFirst = profile['aiMovesFirst'] ?? false;
|
||||
Config.aiIsLazy = profile['aiIsLazy'] ?? false;
|
||||
Config.skillLevel = profile['skillLevel'] ?? 20;
|
||||
Config.isAutoRestart = profile['isAutoRestart'] ?? false;
|
||||
Config.isAutoChangeFirstMove = profile['isAutoChangeFirstMove'] ?? false;
|
||||
Config.resignIfMostLose = profile['resignIfMostLose'] ?? false;
|
||||
Config.shufflingEnabled = profile['shufflingEnabled'] ?? true;
|
||||
Config.learnEndgame = profile['learnEndgame'] ?? false;
|
||||
Config.idsEnabled = profile['idsEnabled'] ?? false;
|
||||
Config.depthExtension = profile['depthExtension'] ?? false;
|
||||
Config.openingBook = profile['openingBook'] ?? false;
|
||||
Config.toneEnabled = profile['ToneEnabled'] ?? true;
|
||||
Config.thinkingTime = profile['ThinkingTime'] ?? 5000;
|
||||
Config.aiMovesFirst = profile['AiMovesFirst'] ?? false;
|
||||
Config.aiIsLazy = profile['AiIsLazy'] ?? false;
|
||||
Config.skillLevel = profile['SkillLevel'] ?? 20;
|
||||
Config.isAutoRestart = profile['IsAutoRestart'] ?? false;
|
||||
Config.isAutoChangeFirstMove = profile['IsAutoChangeFirstMove'] ?? false;
|
||||
Config.resignIfMostLose = profile['ResignIfMostLose'] ?? false;
|
||||
Config.shufflingEnabled = profile['ShufflingEnabled'] ?? true;
|
||||
Config.learnEndgame = profile['LearnEndgame'] ?? false;
|
||||
Config.idsEnabled = profile['IdsEnabled'] ?? false;
|
||||
Config.depthExtension = profile['DepthExtension'] ?? false;
|
||||
Config.openingBook = profile['OpeningBook'] ?? false;
|
||||
|
||||
// Color
|
||||
Config.boardLineColor =
|
||||
profile['boardLineColor'] ?? UIColors.boardLineColor.value;
|
||||
profile['BoardLineColor'] ?? UIColors.boardLineColor.value;
|
||||
Config.darkBackgroundColor =
|
||||
profile['darkBackgroundColor'] ?? UIColors.darkBackgroundColor.value;
|
||||
profile['DarkBackgroundColor'] ?? UIColors.darkBackgroundColor.value;
|
||||
Config.boardBackgroundColor =
|
||||
profile['boardBackgroundColor'] ?? UIColors.boardBackgroundColor.value;
|
||||
profile['BoardBackgroundColor'] ?? UIColors.boardBackgroundColor.value;
|
||||
|
||||
// Rules
|
||||
rule.piecesCount = Config.piecesCount = profile['piecesCount'] ?? 12;
|
||||
rule.piecesCount = Config.piecesCount = profile['PiecesCount'] ?? 12;
|
||||
rule.piecesAtLeastCount =
|
||||
Config.piecesAtLeastCount = profile['piecesAtLeastCount'] ?? 3;
|
||||
Config.piecesAtLeastCount = profile['PiecesAtLeastCount'] ?? 3;
|
||||
rule.hasObliqueLines =
|
||||
Config.hasObliqueLines = profile['hasObliqueLines'] ?? true;
|
||||
Config.hasObliqueLines = profile['HasObliqueLines'] ?? true;
|
||||
rule.hasBannedLocations =
|
||||
Config.hasBannedLocations = profile['hasBannedLocations'] ?? true;
|
||||
Config.hasBannedLocations = profile['HasBannedLocations'] ?? true;
|
||||
rule.isDefenderMoveFirst =
|
||||
Config.isDefenderMoveFirst = profile['isDefenderMoveFirst'] ?? true;
|
||||
Config.isDefenderMoveFirst = profile['IsDefenderMoveFirst'] ?? true;
|
||||
rule.mayRemoveMultiple =
|
||||
Config.mayRemoveMultiple = profile['mayRemoveMultiple'] ?? false;
|
||||
Config.mayRemoveMultiple = profile['MayRemoveMultiple'] ?? false;
|
||||
rule.mayRemoveFromMillsAlways = Config.mayRemoveFromMillsAlways =
|
||||
profile['mayRemoveFromMillsAlways'] ?? true;
|
||||
profile['MayRemoveFromMillsAlways'] ?? true;
|
||||
rule.isBlackLoseButNotDrawWhenBoardFull =
|
||||
Config.isBlackLoseButNotDrawWhenBoardFull =
|
||||
profile['isBlackLoseButNotDrawWhenBoardFull'] ?? true;
|
||||
profile['IsBlackLoseButNotDrawWhenBoardFull'] ?? true;
|
||||
rule.isLoseButNotChangeSideWhenNoWay =
|
||||
Config.isLoseButNotChangeSideWhenNoWay =
|
||||
profile['isLoseButNotChangeSideWhenNoWay'] ?? true;
|
||||
rule.mayFly = Config.mayFly = profile['mayFly'] ?? false;
|
||||
profile['IsLoseButNotChangeSideWhenNoWay'] ?? true;
|
||||
rule.mayFly = Config.mayFly = profile['MayFly'] ?? false;
|
||||
rule.maxStepsLedToDraw =
|
||||
Config.maxStepsLedToDraw = profile['maxStepsLedToDraw'] ?? 50;
|
||||
Config.maxStepsLedToDraw = profile['MaxStepsLedToDraw'] ?? 50;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -109,39 +109,39 @@ class Config {
|
|||
static Future<bool> save() async {
|
||||
final profile = await Profile.shared();
|
||||
|
||||
profile['toneEnabled'] = Config.toneEnabled;
|
||||
profile['thinkingTime'] = Config.thinkingTime;
|
||||
profile['aiMovesFirst'] = Config.aiMovesFirst;
|
||||
profile['aiIsLazy'] = Config.aiIsLazy;
|
||||
profile['skillLevel'] = Config.skillLevel;
|
||||
profile['isAutoRestart'] = Config.isAutoRestart;
|
||||
profile['isAutoChangeFirstMove'] = Config.isAutoChangeFirstMove;
|
||||
profile['resignIfMostLose'] = Config.resignIfMostLose;
|
||||
profile['shufflingEnabled'] = Config.shufflingEnabled;
|
||||
profile['learnEndgame'] = Config.learnEndgame;
|
||||
profile['idsEnabled'] = Config.idsEnabled;
|
||||
profile['depthExtension'] = Config.depthExtension;
|
||||
profile['openingBook'] = Config.openingBook;
|
||||
profile['ToneEnabled'] = Config.toneEnabled;
|
||||
profile['ThinkingTime'] = Config.thinkingTime;
|
||||
profile['AiMovesFirst'] = Config.aiMovesFirst;
|
||||
profile['AiIsLazy'] = Config.aiIsLazy;
|
||||
profile['SkillLevel'] = Config.skillLevel;
|
||||
profile['IsAutoRestart'] = Config.isAutoRestart;
|
||||
profile['IsAutoChangeFirstMove'] = Config.isAutoChangeFirstMove;
|
||||
profile['ResignIfMostLose'] = Config.resignIfMostLose;
|
||||
profile['ShufflingEnabled'] = Config.shufflingEnabled;
|
||||
profile['LearnEndgame'] = Config.learnEndgame;
|
||||
profile['IdsEnabled'] = Config.idsEnabled;
|
||||
profile['DepthExtension'] = Config.depthExtension;
|
||||
profile['OpeningBook'] = Config.openingBook;
|
||||
|
||||
// Color
|
||||
profile['boardLineColor'] = Config.boardLineColor;
|
||||
profile['darkBackgroundColor'] = Config.darkBackgroundColor;
|
||||
profile['boardBackgroundColor'] = Config.boardBackgroundColor;
|
||||
profile['BoardLineColor'] = Config.boardLineColor;
|
||||
profile['DarkBackgroundColor'] = Config.darkBackgroundColor;
|
||||
profile['BoardBackgroundColor'] = Config.boardBackgroundColor;
|
||||
|
||||
// Rules
|
||||
profile['piecesCount'] = Config.piecesCount;
|
||||
profile['piecesAtLeastCount'] = Config.piecesAtLeastCount;
|
||||
profile['hasObliqueLines'] = Config.hasObliqueLines;
|
||||
profile['hasBannedLocations'] = Config.hasBannedLocations;
|
||||
profile['isDefenderMoveFirst'] = Config.isDefenderMoveFirst;
|
||||
profile['mayRemoveMultiple'] = Config.mayRemoveMultiple;
|
||||
profile['mayRemoveFromMillsAlways'] = Config.mayRemoveFromMillsAlways;
|
||||
profile['isBlackLoseButNotDrawWhenBoardFull'] =
|
||||
profile['PiecesCount'] = Config.piecesCount;
|
||||
profile['PiecesAtLeastCount'] = Config.piecesAtLeastCount;
|
||||
profile['HasObliqueLines'] = Config.hasObliqueLines;
|
||||
profile['HasBannedLocations'] = Config.hasBannedLocations;
|
||||
profile['IsDefenderMoveFirst'] = Config.isDefenderMoveFirst;
|
||||
profile['MayRemoveMultiple'] = Config.mayRemoveMultiple;
|
||||
profile['MayRemoveFromMillsAlways'] = Config.mayRemoveFromMillsAlways;
|
||||
profile['IsBlackLoseButNotDrawWhenBoardFull'] =
|
||||
Config.isBlackLoseButNotDrawWhenBoardFull;
|
||||
profile['isLoseButNotChangeSideWhenNoWay'] =
|
||||
profile['IsLoseButNotChangeSideWhenNoWay'] =
|
||||
Config.isLoseButNotChangeSideWhenNoWay;
|
||||
profile['mayFly'] = Config.mayFly;
|
||||
profile['maxStepsLedToDraw'] = Config.maxStepsLedToDraw;
|
||||
profile['MayFly'] = Config.mayFly;
|
||||
profile['MaxStepsLedToDraw'] = Config.maxStepsLedToDraw;
|
||||
|
||||
profile.commit();
|
||||
|
||||
|
|
|
@ -105,26 +105,26 @@ class NativeEngine extends AiEngine {
|
|||
await send('setoption name SkillLevel value ${Config.skillLevel}');
|
||||
await send('setoption name AiIsLazy value ${Config.aiIsLazy}');
|
||||
await send('setoption name Shuffling value ${Config.shufflingEnabled}');
|
||||
await send('setoption name piecesCount value ${Config.piecesCount}');
|
||||
await send('setoption name PiecesCount value ${Config.piecesCount}');
|
||||
await send(
|
||||
'setoption name piecesAtLeastCount value ${Config.piecesAtLeastCount}');
|
||||
'setoption name PiecesAtLeastCount value ${Config.piecesAtLeastCount}');
|
||||
await send(
|
||||
'setoption name hasObliqueLines value ${Config.hasObliqueLines}');
|
||||
'setoption name HasObliqueLines value ${Config.hasObliqueLines}');
|
||||
await send(
|
||||
'setoption name hasBannedLocations value ${Config.hasBannedLocations}');
|
||||
'setoption name HasBannedLocations value ${Config.hasBannedLocations}');
|
||||
await send(
|
||||
'setoption name isDefenderMoveFirst value ${Config.isDefenderMoveFirst}');
|
||||
'setoption name IsDefenderMoveFirst value ${Config.isDefenderMoveFirst}');
|
||||
await send(
|
||||
'setoption name mayRemoveMultiple value ${Config.mayRemoveMultiple}');
|
||||
'setoption name MayRemoveMultiple value ${Config.mayRemoveMultiple}');
|
||||
await send(
|
||||
'setoption name mayRemoveFromMillsAlways value ${Config.mayRemoveFromMillsAlways}');
|
||||
'setoption name MayRemoveFromMillsAlways value ${Config.mayRemoveFromMillsAlways}');
|
||||
await send(
|
||||
'setoption name isBlackLoseButNotDrawWhenBoardFull value ${Config.isBlackLoseButNotDrawWhenBoardFull}');
|
||||
'setoption name IsBlackLoseButNotDrawWhenBoardFull value ${Config.isBlackLoseButNotDrawWhenBoardFull}');
|
||||
await send(
|
||||
'setoption name isLoseButNotChangeSideWhenNoWay value ${Config.isLoseButNotChangeSideWhenNoWay}');
|
||||
await send('setoption name mayFly value ${Config.mayFly}');
|
||||
'setoption name IsLoseButNotChangeSideWhenNoWay value ${Config.isLoseButNotChangeSideWhenNoWay}');
|
||||
await send('setoption name MayFly value ${Config.mayFly}');
|
||||
await send(
|
||||
'setoption name maxStepsLedToDraw value ${Config.maxStepsLedToDraw}');
|
||||
'setoption name MaxStepsLedToDraw value ${Config.maxStepsLedToDraw}');
|
||||
}
|
||||
|
||||
String getPositionFen(Position position) {
|
||||
|
|
|
@ -128,8 +128,8 @@ void Game::loadSettings()
|
|||
|
||||
settings = new QSettings(SETTINGS_FILE, QSettings::IniFormat);
|
||||
|
||||
setEngineBlack(empty? false : settings->value("Options/blackIsAiPlayer").toBool());
|
||||
setEngineWhite(empty ? true : settings->value("Options/whiteIsAiPlayer").toBool());
|
||||
setEngineBlack(empty? false : settings->value("Options/BlackIsAiPlayer").toBool());
|
||||
setEngineWhite(empty ? true : settings->value("Options/WhiteIsAiPlayer").toBool());
|
||||
setFixWindowSize(empty ? false : settings->value("Options/FixWindowSize").toBool());
|
||||
setSound(empty ? true : settings->value("Options/Sound").toBool());
|
||||
setAnimation(empty ? true : settings->value("Options/Animation").toBool());
|
||||
|
@ -145,7 +145,7 @@ void Game::loadSettings()
|
|||
setAutoRestart(empty ? false : settings->value("Options/AutoRestart").toBool());
|
||||
setAutoChangeFirstMove(empty ? false : settings->value("Options/AutoChangeFirstMove").toBool());
|
||||
|
||||
setRule(empty ? DEFAULT_RULE_NUMBER : settings->value("Options/ruleNo").toInt());
|
||||
setRule(empty ? DEFAULT_RULE_NUMBER : settings->value("Options/RuleNo").toInt());
|
||||
}
|
||||
|
||||
Game::~Game()
|
||||
|
@ -397,7 +397,7 @@ void Game::setRule(int ruleNo, int stepLimited /*= -1*/, int timeLimited /*= -1*
|
|||
// Reset game
|
||||
gameReset();
|
||||
|
||||
settings->setValue("Options/ruleNo", ruleNo);
|
||||
settings->setValue("Options/RuleNo", ruleNo);
|
||||
}
|
||||
|
||||
void Game::setEngine(Color color, bool enabled)
|
||||
|
@ -416,13 +416,13 @@ void Game::setEngine(Color color, bool enabled)
|
|||
void Game::setEngineBlack(bool enabled)
|
||||
{
|
||||
setEngine(BLACK, enabled);
|
||||
settings->setValue("Options/blackIsAiPlayer", enabled);
|
||||
settings->setValue("Options/BlackIsAiPlayer", enabled);
|
||||
}
|
||||
|
||||
void Game::setEngineWhite(bool enabled)
|
||||
{
|
||||
setEngine(WHITE, enabled);
|
||||
settings->setValue("Options/whiteIsAiPlayer", enabled);
|
||||
settings->setValue("Options/WhiteIsAiPlayer", enabled);
|
||||
}
|
||||
|
||||
void Game::setAiDepthTime(int time1, int time2)
|
||||
|
|
Loading…
Reference in New Issue