test(compare): trace deterministic monthly seed progression

This commit is contained in:
2026-08-03 18:57:01 +00:00
parent 3b2fd1082f
commit f16a6b6880
23 changed files with 1274 additions and 213 deletions
+31 -8
View File
@@ -2,7 +2,7 @@
namespace sammo\Command\General;
use \sammo\{
DB, Util, JosaUtil,
DB, Util, JosaUtil, Json,
General,
ActionLogger,
LastTurn,
@@ -118,12 +118,35 @@ class che_기술연구 extends che_상업투자{
$score /= 4;
}
$genCount = Util::valueFit(
$db->queryFirstField('SELECT gennum FROM nation WHERE nation=%i', $general->getVar('nation')),
GameConst::$initialNationGenLimit
);
$nationUpdated = [
$genCount = Util::valueFit(
$db->queryFirstField('SELECT gennum FROM nation WHERE nation=%i', $general->getVar('nation')),
GameConst::$initialNationGenLimit
);
$traceGeneralIds = getenv('REF_AI_TRACE_GENERAL_IDS');
$traceNationIds = getenv('REF_AI_TRACE_NATION_IDS');
if (
PHP_SAPI === 'cli'
&& getenv('REF_DETERMINISTIC_INSTALL_ENABLED') === '1'
&& (
(is_string($traceGeneralIds)
&& in_array((string) $general->getID(), explode(',', $traceGeneralIds), true))
|| (is_string($traceNationIds)
&& in_array((string) $general->getVar('nation'), explode(',', $traceNationIds), true))
)
) {
fwrite(STDOUT, 'AI_ACTION_PATCH_TRACE ' . Json::encode([
'engine' => 'ref-tech',
'generalId' => $general->getID(),
'nationId' => $general->getVar('nation'),
'currentTech' => $this->nation['tech'],
'techScore' => $score,
'generalCount' => $genCount,
'delta' => $score / $genCount,
]) . "\n");
}
$nationUpdated = [
'tech' => $this->nation['tech'] + $score/$genCount
];
$db->update('nation', $nationUpdated, 'nation=%i', $general->getVar('nation'));
@@ -143,4 +166,4 @@ class che_기술연구 extends che_상업투자{
}
}
}