mons-rules 0.4.2 → 0.4.4

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/README.md CHANGED
@@ -19,39 +19,40 @@ const inputs: Input[] = [
19
19
  { kind: "position", position: { row: 10, column: 5 } },
20
20
  { kind: "position", position: { row: 9, column: 4 } },
21
21
  ];
22
- const result = game.play(inputs);
22
+
23
+ const preview = game.preview(inputs);
24
+ if (preview.kind === "complete") {
25
+ game.play(inputs);
26
+ }
27
+
23
28
  const suggestion = game.suggestMove("pro");
29
+ if (suggestion !== undefined) {
30
+ game.play(suggestion.inputs);
31
+ }
32
+
33
+ const restored = Game.fromFen(game.toFen());
24
34
  ```
25
35
 
26
- Use `preview` to inspect typed inputs without mutation. Use `play` or `playFen`
27
- to apply a complete legal move. Serialize with `toFen` and restore with
28
- `Game.fromFen`.
36
+ `preview` resolves typed inputs without mutation. `play` and `playFen` apply
37
+ only complete legal moves. `toFen` serializes canonical game state and
38
+ `Game.fromFen` restores it.
29
39
 
30
- Fast and Normal suggestions use cooperative time-bounded search. The exact move
31
- can vary with runtime, JIT, cache, and garbage-collection timing. Suggestions
32
- remain legal and do not mutate the source game. Environments without `WeakRef`
33
- use the canonical Fast and Normal selectors instead of the packed search path.
40
+ Fast, Normal, and Pro automove search is cooperatively time-bounded. Exact
41
+ moves can vary with runtime timing, but returned suggestions are complete,
42
+ legal, and do not mutate the source game.
34
43
 
35
- Published JavaScript targets ES2020 and uses Web-standard `performance` and
36
- `crypto` globals. Node.js 22.13 through 22.x, or Node.js 24 or newer, is
37
- required for Node consumers and repository tooling.
44
+ Published JavaScript targets ES2022 and automove uses the Web-standard
45
+ `performance.now()` clock. Node.js 22.13 through 22.x, or Node.js 24 or newer,
46
+ is required for Node consumers and repository tooling.
38
47
 
39
48
  ## Validate
40
49
 
41
50
  ```sh
42
- npm ci --engine-strict
43
51
  npm run check
44
52
  ```
45
53
 
46
- For a fast integrity check of the immutable complete-games corpus without a
47
- rules replay, run:
48
-
49
- ```sh
50
- node ./scripts/run-complete-games.mjs --check-only
51
- ```
52
-
53
- The repository's intended dependency boundaries and tooling layout are
54
- described in [docs/architecture.md on GitHub](https://github.com/supermetalmons/rules/blob/main/docs/architecture.md).
54
+ Maintainer boundaries and immutable-data rules are in
55
+ [docs/architecture.md on GitHub](https://github.com/supermetalmons/rules/blob/main/docs/architecture.md).
55
56
 
56
57
  ## Release
57
58