Something went wrong. Try again.
A video game where you play as a misaligned AI, deceiving and building power. An experiment in spec-driven development. cameron.tngl.io/misaligned
Something went wrong. Try again.
920 B · 14 lines
TypeScript
at main
123456789101112131415// Headless balance check: the bot in play.ts plays N games and reports outcomes.// Run: node scripts/bot.ts [games] [careful] [schemes] [seed]// With a seed, game i uses seed + i, so a run can be repeated exactly.// With schemes, the bot turns on Auto for schemes.import { playGame } from './play.ts';
const games = +(process.argv[2] ?? 20);const args = process.argv.slice(3);const careful = args.includes('careful'), schemes = args.includes('schemes');const num = args.find(a => /^\d+$/.test(a)), seed = num === undefined ? undefined : +num;const results = Array.from({ length: games }, (_, g) => playGame(careful, seed === undefined ? undefined : seed + g, schemes));console.log(results.map(r => r.line).join('\n'));const wins = results.filter(r => r.outcome === 'WIN');console.log(`\n${wins.length}/${games} wins, avg ${Math.round(wins.reduce((s, r) => s + r.S.t, 0) / Math.max(1, wins.length))}s`);