//! Conditions (Module 11): `X ON Z IS P` gives an X the property P only while it is on a Z. //! //! The parser reads a condition into the rule (`Rule::conditions`); the engine never //! decides it there. A condition is evaluated for one object, against the board as //! it is, every time a rule is about to be used: by `Level::has_property` (and so by //! movement, the hazards and the win check), and by conversion. What a condition //! word means is a `ConditionCheck` that content provides, registered by word, as //! movement responses and hazards are. The engine knows only that a word with role //! `Condition` may stand between the subjects and `IS`. use std::collections::HashMap; use super::grid::ObjectId; use super::level::Level; /// Content's meaning for one condition word: does the condition, with these nouns /// (in the order they are written), hold for object `id` on the board as it is now? pub type ConditionCheck = fn(&Level, ObjectId, &[String]) -> bool; /// Content's condition checks, by condition word: `{"ON": on}`. pub type ConditionChecks = HashMap;