INNER CODE UNIT · JavaScript

createRuntime

Sisyphe42/ReignsAgent · packages/core/src/index.js:39

export function createRuntime(options = {}) {
  const cards = normalizeCards(options.cards ?? []);
  const state = createInitialState(options.state ?? options.initialState ?? {});
  const rng = options.rng ?? Math.random;
  const events = [];

  if (typeof rng !== "function") {
    throw new CoreError("rng must be a function");
  }

  const runtime = {
    get state() {
      return state;
    },

    get cards() {
      return cards;
    },

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…