Compare commits

...
@@ -95,7 +95,7 @@ struct ImmediateAndLookaheadScore {
bool isDefender,
int remainingLookahead,
int maxRepeatCount,
const shared_ptr<ShardokEngine> &innerEngine,
const ShardokEngine innerEngine,
ScoreValue currentUtility,
const AIStrategy &attackerStrategy,
const SettingsGetter &settingsGetter,
@@ -964,7 +964,7 @@ auto BasicLookaheadCalculator(
const bool isDefender,
const int remainingLookahead,
const int maxRepeatCount,
const shared_ptr<ShardokEngine> &innerEngine,
const ShardokEngine innerEngine,
const ScoreValue currentUtility,
const AIStrategy &attackerStrategy,
const SettingsGetter &settingsGetter,
@@ -975,7 +975,7 @@ auto BasicLookaheadCalculator(
-> std::future<eagle0::common::TaskResult<ScoreValue>> {
const auto nextUtility = currentUtility;
if (const CommandListSPtr nextCommands = innerEngine->GetAvailableCommandsForAIPlayer(pid);
if (const CommandListSPtr nextCommands = innerEngine.GetAvailableCommandsForAIPlayer(pid);
nextCommands && !nextCommands->empty()) {
// Get the future from BestCommandIndex without calling .get()
auto bestCommandFuture = BestCommandIndex(
@@ -983,7 +983,7 @@ auto BasicLookaheadCalculator(
isDefender,
remainingLookahead - 1,
maxRepeatCount,
*innerEngine,
innerEngine,
attackerStrategy,
nextUtility,
settingsGetter,
@@ -1003,7 +1003,7 @@ auto BasicLookaheadCalculator(
bestCommandFuture.get();
if (auto &nextCommand =
innerEngine->GetAvailableCommandsForAIPlayer(pid)->at(index);
innerEngine.GetAvailableCommandsForAIPlayer(pid)->at(index);
nextCommand->GetCommandType() !=
net::eagle0::shardok::common::END_TURN_COMMAND) {
return eagle0::common::TaskResult<ScoreValue>::Success(immediateScore);
@@ -1045,12 +1045,12 @@ auto CalcOne(
return returnValue;
}
auto innerEngine = std::make_shared<ShardokEngine>(guessedEngine, false);
innerEngine->PostCommand(pid, commandIndex, randomGenerator);
auto innerEngine = ShardokEngine(guessedEngine, false);
innerEngine.PostCommand(pid, commandIndex, randomGenerator);
auto innerUtility = AIScoreCalculator::GuessedStateScore(
isDefender,
innerEngine->GetCurrentGameState(),
innerEngine.GetCurrentGameState(),
attackerStrategy,
allCastleCoords,
settingsGetter,