This commit is contained in:
Forrest 2026-09-28 02:54:54 -04:00
parent e590baf28d
commit 6382de19c9
15 changed files with 239 additions and 28 deletions

View file

@ -16,10 +16,14 @@ test('random bots play 200 games with every card without breaking a rule', () =>
});
test('greedy bots play 200 games without breaking a rule', () => {
let wins = 0;
for (let seed = 1; seed <= 200; seed++) {
const s = playGame({ pool, bots: [() => greedyBot(), () => greedyBot()], seed, check: true });
assert.equal(s.endReason, 'win');
assert.ok(s.over);
if (s.endReason === 'win') wins++;
}
// A rare game stalls: every location defended and no attack at good odds.
assert.ok(wins >= 196, `only ${wins}/200 games ended in a win`);
});
test('greedy beats random', () => {