bgb-engine 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. bgb_engine-0.1.0/.gitignore +14 -0
  2. bgb_engine-0.1.0/CHANGELOG.md +14 -0
  3. bgb_engine-0.1.0/LICENSE +21 -0
  4. bgb_engine-0.1.0/PKG-INFO +92 -0
  5. bgb_engine-0.1.0/README.md +72 -0
  6. bgb_engine-0.1.0/mypy.ini +3 -0
  7. bgb_engine-0.1.0/pyproject.toml +42 -0
  8. bgb_engine-0.1.0/src/bgb_engine/__init__.py +63 -0
  9. bgb_engine-0.1.0/src/bgb_engine/base.py +313 -0
  10. bgb_engine-0.1.0/src/bgb_engine/examples/__init__.py +7 -0
  11. bgb_engine-0.1.0/src/bgb_engine/examples/card_sample/__init__.py +5 -0
  12. bgb_engine-0.1.0/src/bgb_engine/examples/card_sample/definition.py +308 -0
  13. bgb_engine-0.1.0/src/bgb_engine/examples/graph_sample/__init__.py +5 -0
  14. bgb_engine-0.1.0/src/bgb_engine/examples/graph_sample/definition.py +190 -0
  15. bgb_engine-0.1.0/src/bgb_engine/examples/grid_sample/__init__.py +5 -0
  16. bgb_engine-0.1.0/src/bgb_engine/examples/grid_sample/definition.py +312 -0
  17. bgb_engine-0.1.0/src/bgb_engine/primitives/__init__.py +0 -0
  18. bgb_engine-0.1.0/src/bgb_engine/primitives/counters.py +50 -0
  19. bgb_engine-0.1.0/src/bgb_engine/primitives/graph.py +49 -0
  20. bgb_engine-0.1.0/src/bgb_engine/primitives/grid.py +35 -0
  21. bgb_engine-0.1.0/src/bgb_engine/primitives/pending.py +19 -0
  22. bgb_engine-0.1.0/src/bgb_engine/primitives/phases.py +34 -0
  23. bgb_engine-0.1.0/src/bgb_engine/primitives/projection.py +13 -0
  24. bgb_engine-0.1.0/src/bgb_engine/primitives/rng.py +8 -0
  25. bgb_engine-0.1.0/src/bgb_engine/primitives/turn.py +26 -0
  26. bgb_engine-0.1.0/src/bgb_engine/primitives/zones.py +55 -0
  27. bgb_engine-0.1.0/src/bgb_engine/py.typed +0 -0
  28. bgb_engine-0.1.0/tests/test_examples.py +69 -0
  29. bgb_engine-0.1.0/tests/test_graph_sample_game.py +83 -0
  30. bgb_engine-0.1.0/tests/test_primitives.py +195 -0
  31. bgb_engine-0.1.0/tests/test_public_api.py +27 -0
@@ -0,0 +1,14 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .env
4
+ .venv/
5
+ .vscode/
6
+ .pytest_cache/
7
+ .mypy_cache/
8
+ .coverage
9
+ .temp/
10
+ dist/
11
+ db.sqlite3
12
+ media/
13
+ staticfiles/
14
+
@@ -0,0 +1,14 @@
1
+ # BoardGameBot Engine Changelog
2
+
3
+ ## 0.1.0
4
+
5
+ - Pure-Python engine with no host-framework dependency.
6
+ - Game contract for setup, actions, transitions, rendering, scoring and rules upgrades.
7
+ - Turn-based play with pending choices and out-of-turn reactions.
8
+ - Public, hidden and per-seat private state.
9
+ - Deterministic seeded replay.
10
+ - Cards, zones, counters and turn order.
11
+ - Grid boards.
12
+ - Graph boards.
13
+ - Installable game plugins.
14
+ - Card, Grid and Graph reference games.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Pliskin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,92 @@
1
+ Metadata-Version: 2.5
2
+ Name: bgb-engine
3
+ Version: 0.1.0
4
+ Summary: BoardGameBot engine for asynchronous turn-based board games on Discord
5
+ License: MIT
6
+ License-File: LICENSE
7
+ Keywords: asynchronous,board game,board game engine,boardgamebot,discord,discord bot,play-by-post,turn-based
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.14
14
+ Classifier: Topic :: Communications :: Chat
15
+ Classifier: Topic :: Games/Entertainment :: Board Games
16
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
17
+ Classifier: Typing :: Typed
18
+ Requires-Python: >=3.14
19
+ Description-Content-Type: text/markdown
20
+
21
+ # BoardGameBot Engine
22
+
23
+ An engine for asynchronous, turn-based board games played through Discord.
24
+
25
+ It has no Django, Discord or web dependency.
26
+
27
+ ## Features
28
+
29
+ - A game contract for setup, actions, transitions, rendering, scoring and rules upgrades.
30
+ - Turn-based play with pending choices and out-of-turn reactions.
31
+ - Public, hidden and per-seat private state.
32
+ - Deterministic seeded replay.
33
+ - Cards, zones, counters and turn order.
34
+ - Grid boards.
35
+ - Graph boards.
36
+ - Installable game plugins.
37
+ - Card, Grid and Graph reference games.
38
+
39
+ ## Install
40
+
41
+ ```sh
42
+ pip install bgb-engine
43
+ ```
44
+
45
+ ## Use
46
+
47
+ ```python
48
+ from bgb_engine import GameDefinition, RenderModel
49
+ ```
50
+
51
+ The reference games live in `bgb_engine.examples`:
52
+
53
+ ```python
54
+ from bgb_engine.examples import (CardSampleGame, GraphSampleGame,
55
+ GridSampleGame)
56
+ ```
57
+
58
+ They are also installed as plugins for BoardGameBot through the
59
+ `boardgamebot.games` entry-point group.
60
+
61
+ ## Reference games
62
+
63
+ - `CardSampleGame`: card hands, hidden state, counters and pending choices.
64
+ - `GridSampleGame`: a grid board with hidden cells and scoring.
65
+ - `GraphSampleGame`: a graph board with paths, tokens and a finish condition.
66
+
67
+ The rules for the reference games are in the main project documentation. A
68
+ complete authoring guide is in the repository at `docs/writing-a-game.md`.
69
+
70
+ ## Write a game
71
+
72
+ Implement the `GameDefinition` protocol and declare an entry point in your
73
+ package:
74
+
75
+ ```toml
76
+ [project.entry-points."boardgamebot.games"]
77
+ my-game = "my_game:MyGame"
78
+ ```
79
+
80
+ The entry point may return a definition instance, a class with a zero-argument
81
+ constructor, or a zero-argument factory. The host validates the result and
82
+ refuses duplicate slugs.
83
+
84
+ A non-active seat may act only while it holds an open pending choice. Return
85
+ that seat's legal actions from `legal_actions` and open the choice with a
86
+ `PendingSpec` in a transition. While a choice is open, the host treats only its
87
+ seat as needed for board replacement, pings and private panels; otherwise the
88
+ active seat is needed.
89
+
90
+ ## License
91
+
92
+ BoardGameBot Engine is released under the MIT License.
@@ -0,0 +1,72 @@
1
+ # BoardGameBot Engine
2
+
3
+ An engine for asynchronous, turn-based board games played through Discord.
4
+
5
+ It has no Django, Discord or web dependency.
6
+
7
+ ## Features
8
+
9
+ - A game contract for setup, actions, transitions, rendering, scoring and rules upgrades.
10
+ - Turn-based play with pending choices and out-of-turn reactions.
11
+ - Public, hidden and per-seat private state.
12
+ - Deterministic seeded replay.
13
+ - Cards, zones, counters and turn order.
14
+ - Grid boards.
15
+ - Graph boards.
16
+ - Installable game plugins.
17
+ - Card, Grid and Graph reference games.
18
+
19
+ ## Install
20
+
21
+ ```sh
22
+ pip install bgb-engine
23
+ ```
24
+
25
+ ## Use
26
+
27
+ ```python
28
+ from bgb_engine import GameDefinition, RenderModel
29
+ ```
30
+
31
+ The reference games live in `bgb_engine.examples`:
32
+
33
+ ```python
34
+ from bgb_engine.examples import (CardSampleGame, GraphSampleGame,
35
+ GridSampleGame)
36
+ ```
37
+
38
+ They are also installed as plugins for BoardGameBot through the
39
+ `boardgamebot.games` entry-point group.
40
+
41
+ ## Reference games
42
+
43
+ - `CardSampleGame`: card hands, hidden state, counters and pending choices.
44
+ - `GridSampleGame`: a grid board with hidden cells and scoring.
45
+ - `GraphSampleGame`: a graph board with paths, tokens and a finish condition.
46
+
47
+ The rules for the reference games are in the main project documentation. A
48
+ complete authoring guide is in the repository at `docs/writing-a-game.md`.
49
+
50
+ ## Write a game
51
+
52
+ Implement the `GameDefinition` protocol and declare an entry point in your
53
+ package:
54
+
55
+ ```toml
56
+ [project.entry-points."boardgamebot.games"]
57
+ my-game = "my_game:MyGame"
58
+ ```
59
+
60
+ The entry point may return a definition instance, a class with a zero-argument
61
+ constructor, or a zero-argument factory. The host validates the result and
62
+ refuses duplicate slugs.
63
+
64
+ A non-active seat may act only while it holds an open pending choice. Return
65
+ that seat's legal actions from `legal_actions` and open the choice with a
66
+ `PendingSpec` in a transition. While a choice is open, the host treats only its
67
+ seat as needed for board replacement, pings and private panels; otherwise the
68
+ active seat is needed.
69
+
70
+ ## License
71
+
72
+ BoardGameBot Engine is released under the MIT License.
@@ -0,0 +1,3 @@
1
+ [mypy]
2
+ python_version = 3.14
3
+ strict = True
@@ -0,0 +1,42 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "bgb-engine"
7
+ version = "0.1.0"
8
+ description = "BoardGameBot engine for asynchronous turn-based board games on Discord"
9
+ readme = "README.md"
10
+ requires-python = ">=3.14"
11
+ license = { text = "MIT" }
12
+ keywords = [
13
+ "boardgamebot",
14
+ "board game",
15
+ "asynchronous",
16
+ "turn-based",
17
+ "play-by-post",
18
+ "discord",
19
+ "discord bot",
20
+ "board game engine",
21
+ ]
22
+ classifiers = [
23
+ "Development Status :: 3 - Alpha",
24
+ "Intended Audience :: Developers",
25
+ "License :: OSI Approved :: MIT License",
26
+ "Operating System :: OS Independent",
27
+ "Programming Language :: Python :: 3",
28
+ "Programming Language :: Python :: 3.14",
29
+ "Topic :: Games/Entertainment :: Board Games",
30
+ "Topic :: Communications :: Chat",
31
+ "Topic :: Software Development :: Libraries :: Python Modules",
32
+ "Typing :: Typed",
33
+ ]
34
+ dependencies = []
35
+
36
+ [project.entry-points."boardgamebot.games"]
37
+ card-sample = "bgb_engine.examples.card_sample:CardSampleGame"
38
+ grid-sample = "bgb_engine.examples.grid_sample:GridSampleGame"
39
+ graph-sample = "bgb_engine.examples.graph_sample:GraphSampleGame"
40
+
41
+ [tool.hatch.build.targets.wheel]
42
+ packages = ["src/bgb_engine"]
@@ -0,0 +1,63 @@
1
+ """BoardGameBot Engine contracts, primitives and reference games."""
2
+
3
+ from .base import (Action, ActionOption, CardView, CellView, Context,
4
+ CounterView, GameDefinition, GraphEdgeView, GraphNodeView,
5
+ GraphView, GridView, IllegalAction, LogEntry, LogEntryView,
6
+ OutboxItem, Param, PendingRef, PendingSpec, PendingView,
7
+ RenderModel, SeatRef, SeatView, Setup, TokenView,
8
+ Transition, UpgradableRules, ZoneView)
9
+ from .primitives.counters import Counters
10
+ from .primitives.graph import BoardGraph
11
+ from .primitives.grid import BoardGrid
12
+ from .primitives.pending import for_seat, is_legal
13
+ from .primitives.phases import PhaseMachine
14
+ from .primitives.projection import hand_view
15
+ from .primitives.rng import rng_for
16
+ from .primitives.turn import TurnOrder
17
+ from .primitives.zones import Card, extract, find, shuffled, take
18
+
19
+ __version__ = '0.1.0'
20
+
21
+ __all__ = [
22
+ 'Action',
23
+ 'ActionOption',
24
+ 'BoardGraph',
25
+ 'BoardGrid',
26
+ 'Card',
27
+ 'CardView',
28
+ 'CellView',
29
+ 'Context',
30
+ 'CounterView',
31
+ 'Counters',
32
+ 'GameDefinition',
33
+ 'GraphEdgeView',
34
+ 'GraphNodeView',
35
+ 'GraphView',
36
+ 'GridView',
37
+ 'IllegalAction',
38
+ 'LogEntry',
39
+ 'LogEntryView',
40
+ 'OutboxItem',
41
+ 'Param',
42
+ 'PendingRef',
43
+ 'PendingSpec',
44
+ 'PendingView',
45
+ 'PhaseMachine',
46
+ 'RenderModel',
47
+ 'SeatRef',
48
+ 'SeatView',
49
+ 'Setup',
50
+ 'TokenView',
51
+ 'Transition',
52
+ 'TurnOrder',
53
+ 'UpgradableRules',
54
+ 'ZoneView',
55
+ 'extract',
56
+ 'find',
57
+ 'for_seat',
58
+ 'hand_view',
59
+ 'is_legal',
60
+ 'rng_for',
61
+ 'shuffled',
62
+ 'take',
63
+ ]
@@ -0,0 +1,313 @@
1
+ """The contract every game definition implements.
2
+
3
+ Nothing here imports Django: a definition is played in memory, and the
4
+ persistence layer adapts its rows to these plain values.
5
+ """
6
+
7
+ from dataclasses import dataclass, field
8
+ from typing import Any, Protocol, runtime_checkable
9
+
10
+
11
+ class IllegalAction(Exception):
12
+ """The actor may not take this action in the current context."""
13
+
14
+
15
+ @dataclass(frozen=True)
16
+ class SeatRef:
17
+ """A seat as the engine sees it; no Django model crosses this boundary."""
18
+
19
+ position: int
20
+ role: str = ''
21
+ player_id: int | None = None
22
+ name: str = ''
23
+
24
+
25
+ @dataclass(frozen=True)
26
+ class Param:
27
+ """One argument an action needs, with the values the UI may offer."""
28
+
29
+ key: str
30
+ label: str
31
+ kind: str = 'option'
32
+ options: tuple[Any, ...] = ()
33
+ labels: tuple[str, ...] = ()
34
+
35
+
36
+
37
+ @dataclass(frozen=True)
38
+ class ActionOption:
39
+ """A legal action, rendered as a button, a form or a select."""
40
+
41
+ id: str
42
+ label: str
43
+ params: tuple[Param, ...] = ()
44
+ group: str = ''
45
+ enabled: bool = True
46
+ cost: dict[str, int] = field(default_factory=dict)
47
+
48
+
49
+ @dataclass(frozen=True)
50
+ class Action:
51
+ """What an actor asks to do; ``id`` must be one of the legal options."""
52
+
53
+ actor: int
54
+ id: str
55
+ params: dict[str, Any] = field(default_factory=dict)
56
+
57
+
58
+ @dataclass(frozen=True)
59
+ class PendingRef:
60
+ """A choice still waiting for an answer."""
61
+
62
+ seat: int
63
+ kind: str
64
+ label: str = ''
65
+ options: tuple[Any, ...] = ()
66
+
67
+
68
+ @dataclass(frozen=True)
69
+ class PendingSpec:
70
+ """A choice to open, or to close when ``close`` is set."""
71
+
72
+ seat: int
73
+ kind: str
74
+ label: str = ''
75
+ options: tuple[Any, ...] = ()
76
+ context: dict[str, Any] = field(default_factory=dict)
77
+ close: bool = False
78
+
79
+
80
+ @dataclass(frozen=True)
81
+ class LogEntry:
82
+ text: str
83
+ kind: str = 'info'
84
+
85
+
86
+ @dataclass(frozen=True)
87
+ class OutboxItem:
88
+ kind: str
89
+ payload: dict[str, Any] = field(default_factory=dict)
90
+
91
+
92
+ @dataclass(frozen=True)
93
+ class Setup:
94
+ """The initial deal: public state, shared hidden state, per-seat state."""
95
+
96
+ state: dict[str, Any]
97
+ hidden: dict[str, Any] = field(default_factory=dict)
98
+ private: dict[int, dict[str, Any]] = field(default_factory=dict)
99
+
100
+
101
+ @dataclass(frozen=True)
102
+ class Transition:
103
+ """What one legal action produced.
104
+
105
+ ``state`` replaces the public state; ``hidden`` and ``private`` are
106
+ patches merged into the stored dictionaries.
107
+ """
108
+
109
+ state: dict[str, Any]
110
+ hidden: dict[str, Any] = field(default_factory=dict)
111
+ private: dict[int, dict[str, Any]] = field(default_factory=dict)
112
+ pending: tuple[PendingSpec, ...] = ()
113
+ log: tuple[LogEntry, ...] = ()
114
+ outbox: tuple[OutboxItem, ...] = ()
115
+ active: int | None = None
116
+ phase: str | None = None
117
+ over: bool = False
118
+ random: bool = False
119
+ reveals: bool | None = None
120
+
121
+
122
+ @dataclass(frozen=True)
123
+ class Context:
124
+ """Everything a definition may read while computing a view or an action."""
125
+
126
+ slug: str
127
+ seed: int
128
+ options: dict[str, Any]
129
+ state: dict[str, Any]
130
+ hidden: dict[str, Any]
131
+ private: dict[int, dict[str, Any]]
132
+ seats: tuple[SeatRef, ...]
133
+ phase: str
134
+ active: int | None
135
+ pending: tuple[PendingRef, ...] = ()
136
+
137
+ def seat(self, position: int) -> SeatRef:
138
+ """Return the seat at ``position``; raise ``KeyError`` when absent."""
139
+ for seat in self.seats:
140
+ if seat.position == position:
141
+ return seat
142
+ raise KeyError(f'No seat at position {position}.')
143
+
144
+
145
+ @dataclass(frozen=True)
146
+ class CardView:
147
+ """A card a front end may render."""
148
+
149
+ id: str
150
+ label: str = ''
151
+ value: int = 0
152
+
153
+
154
+ @dataclass(frozen=True)
155
+ class ZoneView:
156
+ """A pile of cards, hidden ones replaced by their count."""
157
+
158
+ kind: str
159
+ label: str
160
+ private: bool = False
161
+
162
+ cards: tuple[CardView, ...] = ()
163
+ hidden_count: int | None = None
164
+
165
+
166
+ @dataclass(frozen=True)
167
+ class SeatView:
168
+ """A seat in the standings, with its public counters."""
169
+
170
+ position: int
171
+ label: str
172
+ is_active: bool = False
173
+ eliminated: bool = False
174
+ counters: dict[str, int] = field(default_factory=dict)
175
+ hidden_cards: int = 0
176
+
177
+
178
+ @dataclass(frozen=True)
179
+ class CounterView:
180
+ """One named counter across every seat."""
181
+
182
+ key: str
183
+ label: str
184
+ values: dict[int, int] = field(default_factory=dict)
185
+
186
+
187
+ @dataclass(frozen=True)
188
+ class PendingView:
189
+ """The choice this seat has to answer, if any."""
190
+
191
+ kind: str
192
+ label: str
193
+ options: tuple[Any, ...] = ()
194
+ deadline: str | None = None
195
+
196
+
197
+ @dataclass(frozen=True)
198
+ class GraphNodeView:
199
+ id: str
200
+ label: str = ''
201
+ x: float = 0.0
202
+ y: float = 0.0
203
+ kind: str = ''
204
+
205
+
206
+ @dataclass(frozen=True)
207
+ class GraphEdgeView:
208
+ source: str
209
+ target: str
210
+ kind: str = ''
211
+ label: str = ''
212
+ owners: tuple[int, ...] = ()
213
+
214
+
215
+ @dataclass(frozen=True)
216
+ class TokenView:
217
+ node: str
218
+ label: str = ''
219
+ owner: int | None = None
220
+
221
+
222
+ @dataclass(frozen=True)
223
+ class GraphView:
224
+ """A board of nodes and edges, with tokens on nodes."""
225
+
226
+ nodes: tuple[GraphNodeView, ...] = ()
227
+ edges: tuple[GraphEdgeView, ...] = ()
228
+ tokens: tuple[TokenView, ...] = ()
229
+
230
+
231
+ @dataclass(frozen=True)
232
+ class CellView:
233
+ column: int
234
+ row: int
235
+ label: str = ''
236
+ kind: str = ''
237
+ tokens: tuple[TokenView, ...] = ()
238
+
239
+
240
+ @dataclass(frozen=True)
241
+ class GridView:
242
+ """A board of squares or hexes."""
243
+
244
+ columns: int
245
+ rows: int
246
+ hexes: bool = False
247
+ cells: tuple[CellView, ...] = ()
248
+
249
+
250
+ @dataclass(frozen=True)
251
+ class LogEntryView:
252
+ text: str
253
+ kind: str = 'info'
254
+
255
+
256
+ @dataclass(frozen=True)
257
+ class RenderModel:
258
+ """One structure both front ends consume."""
259
+
260
+ board: GraphView | GridView | None = None
261
+ zones: tuple[ZoneView, ...] = ()
262
+ seats: tuple[SeatView, ...] = ()
263
+ counters: tuple[CounterView, ...] = ()
264
+ actions: tuple[ActionOption, ...] = ()
265
+ pending: PendingView | None = None
266
+ log: tuple[LogEntryView, ...] = ()
267
+ status: str = ''
268
+
269
+
270
+ @runtime_checkable
271
+ class GameDefinition(Protocol):
272
+ """The rules of one game, registered under a slug."""
273
+
274
+ slug: str
275
+ name: str
276
+ version: int
277
+ min_players: int
278
+ max_players: int
279
+ capabilities: frozenset[str]
280
+
281
+ def validate_setup(self, options: dict[str, Any],
282
+ seats: tuple[SeatRef, ...]) -> None: ...
283
+
284
+ def setup(self, options: dict[str, Any], seats: tuple[SeatRef, ...],
285
+ seed: int) -> Setup: ...
286
+
287
+ def initial_phase(self) -> str: ...
288
+
289
+ def legal_actions(self, ctx: Context,
290
+ actor: int) -> tuple[ActionOption, ...]: ...
291
+
292
+ def apply(self, ctx: Context, action: Action) -> Transition: ...
293
+
294
+ def view(self, ctx: Context, position: int | None) -> RenderModel: ...
295
+
296
+ def summary(self, ctx: Context,
297
+ position: int | None) -> dict[str, Any]: ...
298
+
299
+ def is_over(self, ctx: Context) -> bool: ...
300
+
301
+ def scores(self, ctx: Context) -> list[dict[str, Any]]: ...
302
+
303
+
304
+
305
+ @runtime_checkable
306
+ class UpgradableRules(Protocol):
307
+ """A definition that can carry a running match to newer rules."""
308
+
309
+ def upgrade(self, from_version: int, state: dict[str, Any],
310
+ hidden: dict[str, Any],
311
+ private: dict[int, dict[str, Any]],
312
+ seats: tuple[SeatRef, ...], options: dict[str, Any],
313
+ seed: int) -> Setup | None: ...
@@ -0,0 +1,7 @@
1
+ """Reference games that are also installed as plugins."""
2
+
3
+ from .card_sample import CardSampleGame
4
+ from .graph_sample import GraphSampleGame
5
+ from .grid_sample import GridSampleGame
6
+
7
+ __all__ = ['CardSampleGame', 'GraphSampleGame', 'GridSampleGame']
@@ -0,0 +1,5 @@
1
+ """The numbered-card reference game."""
2
+
3
+ from .definition import CardSampleGame
4
+
5
+ __all__ = ['CardSampleGame']