96 lines
2.3 KiB
Plaintext
96 lines
2.3 KiB
Plaintext
|
|
// Test logical operators in life arc transitions
|
||
|
|
|
||
|
|
life_arc ComplexConditions {
|
||
|
|
state monitoring {
|
||
|
|
// AND operator
|
||
|
|
on age > 18 and status is active -> adult_active
|
||
|
|
on energy > 0.5 and health > 80 -> healthy_energetic
|
||
|
|
|
||
|
|
// OR operator
|
||
|
|
on tired or hungry -> needs_rest
|
||
|
|
on age < 5 or age > 65 -> dependent
|
||
|
|
|
||
|
|
// NOT operator
|
||
|
|
on not ready -> waiting
|
||
|
|
on not completed -> in_progress
|
||
|
|
}
|
||
|
|
|
||
|
|
state adult_active {
|
||
|
|
on age < 18 or status is inactive -> monitoring
|
||
|
|
}
|
||
|
|
|
||
|
|
state healthy_energetic {
|
||
|
|
on energy < 0.3 or health < 50 -> monitoring
|
||
|
|
}
|
||
|
|
|
||
|
|
state needs_rest {
|
||
|
|
on not tired and not hungry -> monitoring
|
||
|
|
}
|
||
|
|
|
||
|
|
state dependent {
|
||
|
|
on age >= 5 and age <= 65 -> monitoring
|
||
|
|
}
|
||
|
|
|
||
|
|
state waiting {
|
||
|
|
on ready -> monitoring
|
||
|
|
}
|
||
|
|
|
||
|
|
state in_progress {
|
||
|
|
on completed -> monitoring
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
life_arc NestedLogic {
|
||
|
|
state checking {
|
||
|
|
// Complex nested conditions
|
||
|
|
on age > 18 and status is active and energy > 0.5 -> triple_and
|
||
|
|
on tired or hungry or sick -> any_problem
|
||
|
|
on not ready and not completed -> both_false
|
||
|
|
|
||
|
|
// Mixed operators
|
||
|
|
on age > 21 and status is verified or is_admin -> allowed
|
||
|
|
on health > 50 and not sick or emergency -> proceed
|
||
|
|
}
|
||
|
|
|
||
|
|
state triple_and {
|
||
|
|
on age < 18 or status is inactive or energy < 0.5 -> checking
|
||
|
|
}
|
||
|
|
|
||
|
|
state any_problem {
|
||
|
|
on not tired and not hungry and not sick -> checking
|
||
|
|
}
|
||
|
|
|
||
|
|
state both_false {
|
||
|
|
on ready or completed -> checking
|
||
|
|
}
|
||
|
|
|
||
|
|
state allowed {
|
||
|
|
on age < 21 and status is unverified and not is_admin -> checking
|
||
|
|
}
|
||
|
|
|
||
|
|
state proceed {
|
||
|
|
on health < 50 and sick and not emergency -> checking
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
life_arc BooleanLogic {
|
||
|
|
state idle {
|
||
|
|
// Boolean literals with operators
|
||
|
|
on enabled is true and paused is false -> running
|
||
|
|
on enabled is false or error is true -> stopped
|
||
|
|
on not initialized -> initializing
|
||
|
|
}
|
||
|
|
|
||
|
|
state running {
|
||
|
|
on enabled is false or paused is true -> idle
|
||
|
|
}
|
||
|
|
|
||
|
|
state stopped {
|
||
|
|
on enabled is true and error is false -> idle
|
||
|
|
}
|
||
|
|
|
||
|
|
state initializing {
|
||
|
|
on initialized -> idle
|
||
|
|
}
|
||
|
|
}
|