clik-engine API
    Preparing search index...

    Class PolicyStrategy

    Calls a PolicyFn each frame to decide which actions to press. Great for heuristic AI, external policy calls, or Claude-driven play.

    The runner awaits the policy, so it can do anything from a decision-tree based on ctx.snapshot() to an external HTTP / preview_eval round-trip where Claude reads scene state and replies with an action set.

    The returned record is applied as a full action state — actions absent from the record are released. Read ctx.snapshot() if you want to preserve current state and only flip some keys.

    new PolicyStrategy(ctx => {
    const snap = ctx.snapshot() as any;
    return {
    left: snap.main.enemyX < snap.main.playerX,
    right: snap.main.enemyX > snap.main.playerX,
    attack: Math.abs(snap.main.enemyX - snap.main.playerX) < 50,
    };
    });

    Implements

    Index

    Constructors

    Methods

    Constructors

    Methods