ogs.dsl.pattern¶
Bases: BaseModel
A complete named composite pattern — the top-level specification unit.
Source code in packages/gds-games/ogs/dsl/pattern.py
specialize(name, terminal_conditions=None, action_spaces=None, initializations=None, inputs=None, composition_type=None, source=None)
¶
Create a derived pattern that inherits this pattern's game tree.
Produces a new Pattern with the same game composition tree,
overriding only the fields explicitly provided. inputs are
inherited from the base pattern unless a replacement list is supplied,
preventing the input-drift problem where derived patterns silently fall
out of sync with their base.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Required name for the derived pattern. |
required |
terminal_conditions
|
list[TerminalCondition] | None
|
Domain-specific terminal conditions. Replaces the base value if provided; otherwise inherits. |
None
|
action_spaces
|
list[ActionSpace] | None
|
Domain-specific action spaces. Replaces the base value if provided; otherwise inherits. |
None
|
initializations
|
list[StateInitialization] | None
|
Domain-specific state initializations. Replaces the base value if provided; otherwise inherits. |
None
|
inputs
|
list[PatternInput] | None
|
If provided, replaces the inherited |
None
|
composition_type
|
CompositionType | None
|
Override the composition type. Defaults to the
base pattern's |
None
|
source
|
str | None
|
Override the provenance tag. Defaults to the base
pattern's |
None
|
Returns:
| Type | Description |
|---|---|
Pattern
|
A new |
Pattern
|
deep-copied) — modifications to the game tree after calling |
Pattern
|
|
Example::
from patterns.multi_party_agreement_zoomed_in import pattern as base
resource_exchange = base.specialize(
name="Multi-Party Resource Exchange",
terminal_conditions=[
TerminalCondition(name="Agreement", actions={...}, outcome="..."),
],
action_spaces=[
ActionSpace(game="Agent 1 Reactive Decision", actions=["accept", "reject"]),
],
# inputs inherited from base automatically
)
Source code in packages/gds-games/ogs/dsl/pattern.py
Bases: BaseModel
An external input that crosses the pattern boundary.
Links to a target game via target_game and flow_label
so the compiler can generate input→game flows automatically.
Source code in packages/gds-games/ogs/dsl/pattern.py
Bases: BaseModel
A condition under which a corecursive loop should terminate.
Each terminal condition specifies a combination of actions from named games (or agents) that triggers termination, along with the resulting outcome and optional payoff description.
Source code in packages/gds-games/ogs/dsl/pattern.py
Bases: BaseModel
The set of available actions for a decision game, with optional constraints.