// Balance, from CLAUDE.md: rushing should mostly lose, careful play should mostly win. // Seeded, so a change in the result means the rules changed, not the dice. // The games run side by side (see scripts/pool.ts): one after another they took most of a minute. import { test } from 'node:test'; import assert from 'node:assert/strict'; import { playMany } from '../scripts/pool.ts'; const seeds = (n: number, from = 1000) => Array.from({ length: n }, (_, i) => from + i); test('rushing mostly loses', async () => { const rs = await playMany(false, seeds(10)), wins = rs.filter(r => r.outcome === 'WIN').length; assert.ok(wins <= 2, `rush won ${wins}/10:\n${rs.map(r => r.line).join('\n')}`); }); test('careful play mostly wins', async () => { const rs = await playMany(true, seeds(6, 1010)), wins = rs.filter(r => r.outcome === 'WIN').length; assert.ok(wins >= 5, `careful won only ${wins}/6:\n${rs.map(r => r.line).join('\n')}`); });