create-eigen-game 0.11.1 → 0.12.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-eigen-game",
3
- "version": "0.11.1",
3
+ "version": "0.12.0",
4
4
  "license": "MIT",
5
5
  "description": "Scaffold an EigenInteractive game Worker and Flutter app without cloning the engine repositories.",
6
6
  "type": "module",
@@ -29,9 +29,9 @@
29
29
  "vitest": "^4.1.10",
30
30
  "wrangler": "^4.110.0",
31
31
  "zod": "^4.4.3",
32
- "@eigeninteractive/testkit": "0.4.1",
33
- "@eigeninteractive/server": "0.4.1",
34
- "@eigeninteractive/rules": "0.4.1"
32
+ "@eigeninteractive/rules": "0.5.0",
33
+ "@eigeninteractive/server": "0.5.0",
34
+ "@eigeninteractive/testkit": "0.5.0"
35
35
  },
36
36
  "engines": {
37
37
  "node": ">=22"
@@ -11,8 +11,6 @@ class ExampleGameModule extends GameModule {
11
11
 
12
12
  @override
13
13
  GameCreationSpec get creationSpec => const GameCreationSpec(
14
- minPlayers: 2,
15
- maxPlayers: 2,
16
14
  timingConfigs: {'Untimed': UntimedConfig()},
17
15
  defaultConfig: {'target': 10},
18
16
  );
@@ -28,6 +28,13 @@ class ExampleGameRulesV1 extends ExampleGameV1RulesBase {
28
28
  Widget buildContent(GameContentContext context) =>
29
29
  _CounterBoard(context: context, rules: this);
30
30
 
31
+ /// Twin of the TS `playerLimits`. The server enforces this one: it refuses a
32
+ /// create whose seat range its rules cannot seat, so keep it equal to the TS
33
+ /// value for this version.
34
+ @override
35
+ PlayerLimits playerLimits(ExampleGameV1Config config) =>
36
+ const PlayerLimits(minPlayers: 2, maxPlayers: 2);
37
+
31
38
  @override
32
39
  String? ratingPool(RatingPoolArgs args) => null;
33
40
 
@@ -36,6 +36,7 @@
36
36
  },
37
37
  "action": {
38
38
  "$schema": "https://json-schema.org/draft/2020-12/schema",
39
+ "additionalProperties": false,
39
40
  "properties": {
40
41
  "amount": {
41
42
  "maximum": 9007199254740991,
@@ -100,6 +101,17 @@
100
101
  "state": {
101
102
  "count": 0
102
103
  }
104
+ },
105
+ {
106
+ "config": {
107
+ "target": 10
108
+ },
109
+ "expected": {
110
+ "maxPlayers": 2,
111
+ "minPlayers": 2
112
+ },
113
+ "kind": "playerLimits",
114
+ "name": "two seats, because applyAction passes the turn with 1 - playerIndex"
103
115
  }
104
116
  ],
105
117
  "schemaVersion": 1
@@ -26,6 +26,17 @@
26
26
  "count": 1
27
27
  }
28
28
  }
29
+ },
30
+ {
31
+ "kind": "playerLimits",
32
+ "name": "two seats, because applyAction passes the turn with 1 - playerIndex",
33
+ "config": {
34
+ "target": 10
35
+ },
36
+ "expected": {
37
+ "minPlayers": 2,
38
+ "maxPlayers": 2
39
+ }
29
40
  }
30
41
  ]
31
42
  }
@@ -52,6 +52,12 @@ export const rulesV1: GameRules<State, Observation, Action, Config> = {
52
52
  pendingPlayers: pending,
53
53
  }),
54
54
 
55
+ // How many seats these rules can actually play. Two here, because
56
+ // `applyAction` passes the turn with `1 - playerIndex`. The engine refuses a
57
+ // create asking for a range outside this, so it is the one place a
58
+ // fixed-size game says so. Read `config` if the count is a creation choice.
59
+ playerLimits: () => ({ minPlayers: 2, maxPlayers: 2 }),
60
+
55
61
  ratingPool: () => null,
56
62
  botSeatable: () => true,
57
63
  };