Complex Rules
Advanced rule patterns for sophisticated simulations.
Compound Conditions
crux
rule complex_behavior {
priority: 5
select: { type: "visitor", tags: ["adult"] }
when (energy > 50 and mood == "happy") or is_excited
do explore(curiosity: 0.8)
}Tag-Based Selection
crux
// Only morning people wake up early
rule wake_early {
priority: 3
select: { tags: ["morning_person"] }
when tick < 360
do set_state(awake: true)
}
// Night owls stay up late
rule stay_up {
priority: 3
select: { tags: ["night_owl"] }
when tick > 1200
do set_state(active: true)
}Zone Interactions
crux
rule enter_cafe {
priority: 4
when in_zone("cafe") and hungry
do order_food(item: "coffee")
}
rule leave_park {
priority: 2
when not in_zone("park") and energy < 20
do move_toward(target: "park")
}