def slots

bendvy-ecs-core@0.1.0.4 · ordinary_condition_declaration.bend:71

import bendvy-ecs-core@0.1.0.4/ordinary_condition_declaration.bend as OrdinaryConditionDeclaration
import Base
import bendvy-ecs-core@0.1.0.4/schedule.bend as Sch
import bendvy-ecs-core@0.1.0.4/schedule_provision.bend as SP

71# Advanced structural check that each system's condition slot is below width.
72# Does not check World association, live registrations or predicate provenance.
73def slots(~S:Data,plan:SP.Plan<S>,+width:Nat) -> Bool:
74  match plan:
75    case SP.Empty{}:True{}
76    case SP.Entry{Sch.System{_,slot},_}:Nat.is_lt(U32.to_nat(slot),width)
77    case SP.Entry{Sch.Phase{_},_}:True{}
78    case SP.Entry{Sch.Barrier{},_}:True{}
79    case SP.Sequence{left,right}:Bool.and(slots(~S,left,width),slots(~S,right,width))

Uses (7)

Used by (1)