Skip to content

Latest commit

 

History

History
80 lines (66 loc) · 4.27 KB

File metadata and controls

80 lines (66 loc) · 4.27 KB

Guided tour

deckmaste.rs is easiest to read along the same path a card takes: Oracle text is compiled into a typed intermediate form, while the card's printed characteristics arrive as structured metadata. That information-complete form can then be rendered back to English or lowered into a shared rules engine. This tour follows one example through that path.

Oracle text becomes typed data

Elesh Norn, Grand Cenobite is the current persisted intermediate form of the card: its characteristics and three composed abilities — vigilance, a static boost for other creatures you control, and a static penalty for creatures your opponents control. There is no Elesh Norn class or resolution script. The two statics use the same predicates and modifications available to every other card.

The canonical form is deliberately minimal as well as complete. It preserves everything rendering and execution need without retaining a parser trace or an expanded machine dump, so a mistranslation can be investigated by comparing this short RON term with the card itself. The built-in macro library provides the compact, rules-shaped names; its construction frames connect those names to the Oracle phrases they recover and spell. Those same frames drive ingestion: the compiled frame lexicon matches the parsed Oracle tree, each match identifies a macro and fills its typed arguments, and nested matches assemble the persisted RON card.

Oracle text is the authoritative input for existing cards; after compilation, the RON term is their canonical semantic representation, joined by the structured characteristics. The curated corpus is still written and verified by hand while structural recovery grows, but its intended producer is the English parser and spelling relation. From here the term macro-expands and lowers into the smaller core vocabulary the engine executes. The crate map in Architecture shows those projections.

The English-side projection checks losslessness: cargo xtask english roundtrip renders every supported face back to the same normalized Oracle bytes. The recovery census separately records how much of that text became structure rather than a preserved unknown span. Recovery coverage and executable-card coverage turn “reading the card explains the card” into two card-by-card measurements.

Rules live in shared systems

Continuous effects meet in layer.rs. Start with run_layer_pass: it applies the layer sequence, asks depends_on whether one effect changes another's affected set, and re-evaluates the remaining order after each application. The code cites the Comprehensive Rules at the point where each ordering constraint enters the algorithm.

The focused tests live beside the implementation. In particular, same_layer_change_enables_conditional_static proves that an earlier effect can enable a later conditional in the same layer, while granted_static_is_gathered_to_fixpoint proves that an ability granted in layer 6 becomes an effect source on the next pass. These are engine behaviors, so every card using those shapes gets them without card-specific code.

Invalid descriptions fail at the boundary

Spec.idr describes card-description states that must be unrepresentable. Its named failing blocks pin both rejection and diagnostic: tBadTargetOutOfRange reads a target slot that was never announced, tBadEventActorMultiKind asks a mixed event family for an actor not every event supplies, and tBadModalOverCount chooses more modes than exist.

cargo xtask idris-check plugins/canon emits the supported Rust card definitions into that model and typechecks them. The Idris code is a grammar oracle, not a second game engine; runtime semantics remain in Rust.

Run the whole path

cargo run bootstraps the current cached demo corpus on first use and launches the terminal client shown in the README. The current scope and the work still in motion are recorded plainly in Present state and roadmap.