motely-wasm 23.0.0 → 23.1.1

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
@@ -1,157 +1,7 @@
1
- # motely-wasm
1
+ # Motely
2
2
 
3
- `motely-wasm` is the Bootsharp/WebAssembly package for MotelyJAML: the production Balatro seed-search engine, JAML loader, JAMLyzer analyzer, JUMMY one-line parser, and selected seed utilities exposed to JavaScript.
3
+ Motely is a fast Balatro seed searching library. It utilizes your CPU's 512-bit registers along with SIMD to search 8 seeds at once per thread.
4
+ It performs very well comapred to current GPU-based balatro seed searches (better in a lot of systems), and is the fastest general purpose CPU based searcher to my knowlegde.
4
5
 
5
- JAML is Jimbo's Ante Markup Language. YAML and JSON are the concrete syntaxes; both load to the same typed `JamlConfig` that the engine executes.
6
-
7
- ## Install
8
-
9
- ```sh
10
- npm install motely-wasm
11
- ```
12
-
13
- ## Boot
14
-
15
- Bootsharp exports a default runtime object plus named API namespaces. Subscribe to exported events and bind imports before `boot()`.
16
-
17
- ```js
18
- import bootsharp, {
19
- MotelyJaml,
20
- MotelyJamlyzer,
21
- MotelySearch,
22
- Jimmolate,
23
- } from "motely-wasm";
24
-
25
- MotelySearch.onProgress.subscribe((p) => {
26
- console.log(`searched=${p.seedsSearched} matches=${p.matchingSeeds}`);
27
- });
28
-
29
- MotelySearch.onSeedMatch.subscribe((seedOrRow) => console.log(seedOrRow));
30
- MotelySearch.onScoredResult.subscribe((result) => console.log(result.seed, result.score));
31
-
32
- Jimmolate.findSeed = (seed, deck, stake) => true;
33
-
34
- await bootsharp.boot();
35
- ```
36
-
37
- ## Parse and validate JAML
38
-
39
- Use `fromYaml` or `fromJson` once, then pass the returned `JamlConfig` to analyzer/search calls. Invalid filters fail loudly; unknown keys are not silently ignored.
40
-
41
- ```js
42
- const jaml = MotelyJaml.fromYaml(`
43
- name: example
44
- deck: Red
45
- stake: White
46
- seeds: [AAAAAAAA, BBBBBBBB]
47
- must:
48
- - voucher: Overstock
49
- antes: [1]
50
- `);
51
-
52
- const error = MotelyJaml.validate("must: [");
53
- if (error) console.error(error);
54
- ```
55
-
56
- ## Analyze seeds with JAMLyzer
57
-
58
- ```js
59
- const results = MotelyJamlyzer.analyzeSeeds(jaml);
60
- for (const result of results) {
61
- console.log(result.seed, result.antes[0].voucher, result.antes[0].packs.length);
62
- }
63
- ```
64
-
65
- Scrollable analysis uses the `streamStates` object returned by a previous page. The state is seed-specific, so resume with a single-seed `JamlConfig`.
66
-
67
- ```js
68
- const first = MotelyJamlyzer.analyzeSeedsPaged(jaml, 10)[0];
69
- const next = MotelyJamlyzer.resumeSeeds(jaml, first.streamStates, 10)[0];
70
- ```
71
-
72
- ## Search
73
-
74
- Searches emit results through events. The returned promise only signals completion.
75
-
76
- ```js
77
- const found = [];
78
- const onResult = (r) => found.push(r.seed);
79
- MotelySearch.onScoredResult.subscribe(onResult);
80
- try {
81
- await MotelySearch.searchList(jaml);
82
- } finally {
83
- MotelySearch.onScoredResult.unsubscribe(onResult);
84
- }
85
- ```
86
-
87
- Available modes:
88
-
89
- ```js
90
- await MotelySearch.searchList(jaml);
91
- await MotelySearch.searchRandom(jaml, 1000);
92
- await MotelySearch.searchSequential(jaml, 0n, 1n, 1);
93
- ```
94
-
95
- `searchSequential` uses bigint batch indices because the C# parameters are `long`.
96
-
97
- ## Jimmolate
98
-
99
- Jimmolate is an optional JS-authored seed predicate in the engine filter chain. The browser-safe WASM surface receives `seed`, `deck`, and `stake`; live `MotelySingleSearchContext` ref-struct streams remain engine-side and are not marshalled to JavaScript.
100
-
101
- ```js
102
- Jimmolate.findSeed = (seed, deck, stake) => seed === "UNITTEST";
103
- Jimmolate.enabled = true;
104
- try {
105
- await MotelySearch.searchList(jaml);
106
- } finally {
107
- Jimmolate.enabled = false;
108
- }
109
- ```
110
-
111
- ## JUMMY
112
-
113
- JUMMY is one human line per JAML criterion. The WASM wrapper delegates to the engine's `JummyLine` parser/formatter so packed item identity stays canonical.
114
-
115
- ```js
116
- MotelyJummy.validate("Eternal Blueprint in antes 1 or 2"); // null
117
- MotelyJummy.canonicalize("Showman in antes 1, 2"); // "Showman in antes 1 or 2"
118
- ```
119
-
120
- ## Utilities
121
-
122
- `MotelyUtilities` exposes seed math and keyword sequence helpers used by the CLI/provider modes.
123
-
124
- ```js
125
- MotelyUtilities.seedToTotalIndex("11111111"); // 66231629136n
126
- MotelyUtilities.totalIndexToSeed(66231629136n); // "11111111"
127
- MotelyUtilities.searchIndexToSeed(0n, 8); // "11111111"
128
- MotelyUtilities.repeatCharKeywords(3)[0]; // "AAA"
129
- ```
130
-
131
- ## Local development
132
-
133
- From `Motely.Wasm/`:
134
-
135
- ```sh
136
- npm test
137
- npm run pack:check
138
- ```
139
-
140
- `npm test` runs `dotnet publish Motely.Wasm.csproj -c Release` first, then runs the Node test suite against `dist/index.mjs`.
141
-
142
- The release script at the repository root syncs `package.json` to `<MotelyVersion>` in `Directory.Packages.props`, publishes the WASM build, runs the JS tests against that artifact, and then calls `npm publish`.
143
-
144
- ## Current coverage focus
145
-
146
- The package test suite mirrors the C# behavior tests that are meaningful through the public WASM surface:
147
-
148
- - boot/runtime and version export
149
- - JAML YAML/JSON parse and validation strictness
150
- - JAMLyzer ante structure, event windows, score-by-analysis, and stream-state resume
151
- - real list/random/sequential searches
152
- - Jimmolate accept/reject/predicate/deck-stake behavior
153
- - AND scoring, default source fallback, Hieroglyph pack-slot reachability, and luck-source regressions
154
- - JUMMY canonicalization
155
- - seed math and keyword utility parity
156
-
157
- Corpus-file loading and live ref-struct seed-router introspection remain native test concerns rather than JavaScript package behavior.
6
+ Thank you so much to [@OptimusPi](https://github.com/OptimusPi/) for commissioning the development of this library. It started out as a personal projects, but
7
+ would not have the capibilities it has today without his support.