Skip to content

Simulation ​

Interface of @v12-engine/engine/testing

ts
export interface Simulation

A game to play many times (simulate): the rules, the map, who the computer plays and how, and what to count

Members ​

ai ​

ts
ai?: (player: PlayerId, world: World) => Partial<AiOptions>;

How the computer plays a player, over what it is given (enemyBases: where the others start)

brains ​

ts
brains?: Record<number, BrainDef | string>;

The brain each player is played by, or its id (one the game lists in Rules.brains, or the engine's core.melee): two brains against each other, for a balance run. A player not named here is played by the first brain the game lists

computers ​

ts
computers?: PlayerId[];

The players the computer plays: every player of the map with a start, the creeps apart, when left out. One left out is the game's own (start) to move, or stands

difficulties ​

ts
difficulties?: Record<number, string>;

How hard each player's computer plays, by name ('hard'): under what ai gives. The seat's own when left out

map ​

ts
map: GameMap;

The map each simulated game is made from

measure ​

ts
measure?: (world: World) => Record<string, Counted>;

What to count at the end of each game, by name: units alive, gold gathered, the hour

onStart ​

ts
onStart?: (world: World) => void;

What the game does once a world is made, before the first tick: units of its own, a rule turned on

rules ​

ts
rules: Rules;

The game module's rules each simulated game is played with

seconds ​

ts
seconds?: number;

Seconds of the game at most: twenty minutes when left out

until ​

ts
until?: (world: World) => boolean;

Whether the game is over before that: once there is a winner, when left out