@pretty-chitty/core
    Preparing search index...

    Interface Game<P, R>

    Core entry point for a pretty-chitty game. This needs to ultimately provide:

    • A way to generate players
    • A way to generate the root chit
    • An async run method to actually execute the game logic
    • A library of chits, buttons and canvases

    See documentation on Turn for more details on how to structure your game logic.

    interface Game<P extends PlayerChit, R extends RootChit<P>> {
        get theme(): GameTheme;
        get chitLibrary(): IChitLibrary<P, R>;
        get canvasLibrary(): ICanvasLibrary;
        get buttonLibrary(): IButtonLibrary;
        get metadata(): GameMetaData;
        tokenMap?: { [key: string]: TokenDefinition };
        run(setup: Turn<GameResult<P>, P, R>, rootChit: R): Promise<GameResult<P>>;
        renderDefaultRootChit?(spec: ChitRenderSpec): void;
        demoPickWeight?(picks: any[], pick: any): number;
    }

    Type Parameters

    Index

    Accessors

    Methods

    • Useful to help the bad AI demo pick more interesting picks. This function should return a multiplier for the weight of a given pick, where the weight is determined by the type of pick (e.g. ButtonPick is 1, ChitPick is the number of chits that can be picked, DragPick is the number of targets that can be dragged to). The picks parameter is the full list of picks available, and the pick parameter is the specific pick we are calculating the weight for.

      Parameters

      • picks: any[]

        The list of available pickes

      • pick: any

        the pick we are looking at

      Returns number

    Properties

    tokenMap?: { [key: string]: TokenDefinition }