All and only the state needed to check game rules: plausible states, permitted next events, rule consequences and outcomes. No simulation or physical model.
A native rule library for game-state validation, legal next actions,
transitions and outcomes, with a bounded interpreter for user-defined
JSON rules. list_games() lists accepted profiles. All 212
retained profiles have accepted, explicitly bounded variants. Read
get_game(id) for the exact variant, required inputs and
limitations; acceptance does not certify every commercial or federation
edition. The R implementation does not invoke Python.
library(ruleatlas)
register_rules("first_to_three.json")
state <- new_state("user.first_to_three",
players = list(list(id = "alice"), list(id = "bob")),
ruleset_version = "1.0.0")
state <- apply_action(state, list(type = "score", params = list(player = 0L)))
outcome(state)Use unnamed lists for JSON arrays and named lists for objects. An
empty JSON object is
structure(list(), names = character()); an empty array is
list(). Indices in rules and actions are zero-based. Public
winners contain participant IDs. NA, nonfinite numbers and
implicit type coercions are rejected.
Registration is session-local. Existing versions are immutable,
including when overwrite=TRUE; register a new version for
changed rules. Nonempty custom variants are rejected until explicit
variant support is implemented.
Expressions use a bounded whitelist. Effects commit atomically and
cannot execute code, shell commands or network requests. Finite action
domains are enumerated up to 512 combinations; larger domains return
guarded event types. Structured errors inherit
ruleatlas_error and expose the same codes as the Python
library.
Maintainer: Dr. Dimitrios Geromichalos riskdatascience@web.de. Author and copyright holder: RiskDataScience GmbH. The package uses the MIT license. Submission status and check results are recorded in the project release evidence.
The library product is named ruleatlas-r. Its R package
identifier is ruleatlas, since R package identifiers cannot
contain hyphens.
S001 implements compact football match rules: goals,
per-player cards, eligibility, substitutions, phases and optional
knockout progression. Use get_game("S001") for its declared
variant and limitations, and legal_actions(state) for
phase-dependent event types and remaining allowances. The repository
contains matching Python and R examples in
examples/football.*. No ball motion, possession or injury
state is stored.