wait¶
Syntax¶
Parameters¶
x- An expression that evaluates to a number of simulation steps. The value is rounded to the nearest integer.
Description¶
Important
This is a special action which cannot appear within an if statement or loop!
A wait rule determines the number of simulation steps before an agent applies its transition rules to determine the next state.
Wait rules are evaluated immediately after the agent performs its actions upon entering the state.
The argument is evaluated and rounded to the nearest integer. If the argument is omitted, it is equivalent to wait(999999), a functionally indefinite wait of more than a century.
If the argument evaluates to 0, the state is a transient state and the transition rules are applied immediately. Transient states with zero wait times are often useful, since they can cause effects that change the agent's other conditions, or they can serve as decision points for moving into different states.
If the argument evaluates to a negative value, then no transition rules are evaluated, and the state becomes an absorbing state.
If a state contains multiple wait rules, the first rule that applies to the agent is used.
Each state must have at least one unconditional wait rule, or a compiler error will result and the program will not execute. Given how wait rules are evaluated, any wait rule after the first unconditional wait rule will be ignored.
Examples¶
wait(1) # Wait 1 hour
wait(0) # Apply transition rules immediately
wait() # Wait indefinitely.
wait(-1) # Wait indefinitely with any negative value.
wait(1.6) # Wait 2 hours. The value of the expression is rounded to the nearest integer.
wait(0.4) # Same as wait(0). The value of the expression is rounded to the nearest integer.
wait(until(2pm)) # wait until the next occurrence of 2pm