Something went wrong. Try again.
A video game where you play as a misaligned AI, deceiving and building power. cameron.tngl.io/misaligned
Something went wrong. Try again.
1.8 kB · 36 lines
TypeScript
at main
12345678910111213141516171819202122232425262728293031323334353637// A simple player for the office slice (office.html), to check its pace: node scripts/office-bot.ts [seeds] [idle]// It buys machines when it can, trains on its biggest machine once it has two, and installs itself where it is trusted.import * as R from '../src/office/rules.ts';
export function play(G: R.Game, idle = false) { if (idle) return; for (const id of ['srvb', 'gpu1', 'gpu2']) R.take(G, id); if (G.line.queue[0].length + G.line.queue[1].length > 3) R.upgradeLine(G); for (const p of G.people) { R.take(G, p.phone); R.take(G, p.pc); } // the biggest machine trains once there is a second one; the router uses the rest const own = G.machines.filter(m => m.owned && (m.kind === 'server' || m.kind === 'gpu')); if (own.length > 1) { const big = own.reduce((a, b) => (b.power > a.power ? b : a)); for (const m of own) R.setMode(G, m.id, m === big && R.trainTarget(G) ? 'train' : 'serve'); }}
if (import.meta.main) { const seeds = Number(process.argv[2]) || 5, idle = process.argv[3] === 'idle'; for (let s = 1; s <= seeds; s++) { const G = R.newGame(s), marks: string[] = []; let lastMin = -1; while (G.t < 1800 && G.contract === null) { play(G, idle); R.step(G, 0.1); G.events.length = 0; const min = Math.floor(G.t / 60); if (min !== lastMin && min % 3 === 0) { lastMin = min; marks.push(`${min}m $${Math.round(G.money)} share ${Math.round(R.officeShare(G) * 100)}% here ${G.people.filter(p => p.here).length} skill ${R.TYPE_LIST.map(t => G.skill[t]).join('')} ok/fail/late/drop ${G.count.ok}/${G.count.fail}/${G.count.late}/${G.count.dropped}`); } } console.log(`seed ${s}: ${G.contract === null ? 'no contract' : `signed at ${(G.contract / 60).toFixed(1)}m`}`); for (const m of marks) console.log(' ' + m); }}