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
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
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
compile()
¶
compile_system()
¶
Compile this pattern to a flat SystemIR for verification + visualization.
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.