Skip to content

ComputerPlayer beta ​

Interface of @v12-engine/engine/ai

ts
export interface ComputerPlayer

A computer player: whatever plays a seat of a world from what it sees, through commands as a player does. The engine's own is a Brain of modules (defineBrain), the melee player among them; a game gives its own in code (defineComputer, listed in Rules.brains). think is asked about once a second (createComputerSystem); save and restore keep what it remembers through a save

Members ​

busy ​

ts
readonly busy?: boolean;

Whether a think is under way across ticks (a brain's budget): it is asked to think on at the next tick

dispose ​

ts
dispose?(): void;

Lets go of what it holds outside its seat, once unseated

inspect ​

ts
inspect?(): unknown;

What it is thinking, as plain data: what the debug tools show of the player it plays (its goal, its scores)

paused ​

ts
paused?: boolean;

Whether it sits still (world.computers.pause). A player without the field cannot be paused

restore ​

ts
restore?(memory: unknown): void;

Takes back what save gave, from a saved game

save ​

ts
save?(): unknown;

Gives what it remembers as plain data for a save; when left out it remembers nothing

tell ​

ts
tell?(word: string, data: unknown, tick: number): void;

Takes in a word from the game (world.computers.tell), with the tick it is told at

think ​

ts
think(): void;

Runs one think: looks at the world and sends commands as a player does