Implementation:AIScientists Dev WorldSeed rotate ops
| Knowledge Sources | |
|---|---|
| Domains | DSL, Simulation |
| Last Updated | 2026-10-26 18:00 GMT |
Overview
Concrete DSL effect operator that advances a property to the next value in a sequence with optional skip-list, provided by the WorldSeed library.
Description
The rotate effect operator registers via `register_effect("rotate", _exec_rotate)`. It finds the current value of a target property within a sequence list, advances to the next entry (wrapping around), and skips any values present in an optional skip list. If the current value is not in the sequence, it starts from before the first element. When all entries are in the skip list, it logs a warning and leaves the property unchanged. An optional `value` field can override the starting position.
Usage
Use this operator in scene YAML for turn-rotation mechanics — e.g., cycling through active roles, advancing a game phase, or rotating the current player while skipping eliminated players.
Code Reference
Source Location
- Repository: WorldSeed
- File: src/worldseed/dsl/effects/rotate_ops.py
Signature
def _exec_rotate(
effect: EffectConfig,
store: StateStore,
event_log: EventLog,
ctx: dict[str, Any],
tick: int,
) -> None:
"""Advance a property to the next value in a sequence (wrapping, with skip)."""
Import
# Auto-registered on import of the effects package:
# import worldseed.dsl.effects # registers "rotate" operator
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| effect.target | str | Yes | Dot-path to the property holding current value |
| effect.sequence | str | Yes | Dot-path to the list property defining the order |
| effect.skip | str | No | Dot-path to a list of values to skip |
| effect.value | str | No | Override starting value (resolved via DSL) |
Outputs
| Name | Type | Description |
|---|---|---|
| side effect | None | Updates target property to next non-skipped sequence entry |
Usage Examples
# Rotate active role, skipping dead players
- operator: rotate
target: "game.active_role"
sequence: "game.role_order"
skip: "game.dead_roles"
# Start rotation from a specific agent
- operator: rotate
target: "game.current_player"
sequence: "game.player_order"
value: "$agent.id"