@fortemate/dicechess-engine-wasm 0.10.0 → 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/README.md CHANGED
@@ -20,6 +20,37 @@ An authenticated mirror is also available from
20
20
 
21
21
  ---
22
22
 
23
+ ## Two entries: the whole engine, or the rules alone
24
+
25
+ The package has two entry points. They come from one build and share the code they have in common,
26
+ so importing both in the same application loads the shared half once.
27
+
28
+ | Import | What it gives you | What it loads |
29
+ | :--- | :--- | :--- |
30
+ | `@fortemate/dicechess-engine` | everything: `DiceChess`, `EngineFacade`, the bots, `getBestMove`, equity, doubling and draw decisions | 1,308,539 B (191,262 B gzipped) |
31
+ | `@fortemate/dicechess-engine/rules` | the rules only: `getLegalUciMoves`, `generateMoves`, `applyMove`, `endTurn`, `perft`, `getPieceFromDice`, `canonicalKey` | 891,712 B (138,394 B gzipped) |
32
+
33
+ Use `/rules` wherever the application validates, applies and renders moves but never asks the engine
34
+ to *play* — a live game against another human, a board editor, an analysis view. The functions are
35
+ identical in name and behaviour to their `DiceChess` counterparts, so migrating is one import:
36
+
37
+ ```javascript
38
+ import { DiceChess } from '@fortemate/dicechess-engine/rules';
39
+
40
+ const dfen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1 PN";
41
+ const legalMoves = DiceChess.getLegalUciMoves(dfen);
42
+ const nextDfen = DiceChess.applyMove(dfen, "e2", "e4");
43
+ ```
44
+
45
+ Both entries also export their functions as plain named exports
46
+ (`import { getLegalUciMoves } from '@fortemate/dicechess-engine/rules'`), and each has its own
47
+ TypeScript declarations (`dicechess-rules.d.ts` for the subpath).
48
+
49
+ The WebAssembly package `@fortemate/dicechess-engine-wasm` has **no** `/rules` subpath: the Scala.js
50
+ WebAssembly backend emits a single module, so that package ships the full API only.
51
+
52
+ ---
53
+
23
54
  ## Quick Start (JavaScript / TypeScript)
24
55
 
25
56
  The package is distributed as a standard ES Module (`type: "module"`).
@@ -94,7 +125,7 @@ const acceptDraw = DiceChess.shouldBotAcceptDraw(finalDfen);
94
125
  ## Features
95
126
 
96
127
  * **Complete Dice Chess Rules**: Implements turn sequencing, unblocking, promotion path calculations, and strict **Maximal Micro-moves Filtering**.
97
- * **Type-Safe**: Shipped with comprehensive TypeScript definition files (`.d.ts`) generated directly from the Scala compiler.
128
+ * **Type-Safe**: Shipped with hand-written TypeScript definition files (`.d.ts`) for both entries, kept in step with the exported Scala.js API.
98
129
  * **Side-Effect Free**: Configured with `sideEffects: false` to allow advanced tree-shaking in modern bundlers like Vite, Webpack, and Rollup.
99
130
  * **Blazing Fast**: Optimized bitwise operations compiled via the advanced Scala.js optimizing linker.
100
131
 
package/main.wasm CHANGED
Binary file