Initial commit: ssessesse ki battle

This commit is contained in:
2026-10-13 11:15:26 +09:00
commit 4f24129e29
104 changed files with 10520 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { chooseBotAction } from '../src/shared/bot.js';
import { isLegalAction } from '../src/shared/rules.js';
test('bot uses only legal actions from public energy, with repeatable injected randomness', () => {
for (const own of [0, 1, 2, 3, 10]) for (const opponent of [0, 1, 3]) for (const r of [0, .1, .5, .9, .999]) {
assert.ok(isLegalAction(chooseBotAction(own, opponent, () => r), own));
}
assert.equal(chooseBotAction(0, 0, () => 0), 'charge');
assert.notEqual(chooseBotAction(3, 3, () => 0), chooseBotAction(3, 3, () => .999));
});