poker-flopsolve 0.1.0 → 0.3.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 +39 -6
- package/dist/browser.js +664 -362
- package/dist/browser.js.map +1 -1
- package/dist/engine-worker.d.ts +2 -0
- package/dist/engine-worker.js +57 -0
- package/dist/engine-worker.js.map +1 -0
- package/dist/index.d.ts +74 -3
- package/dist/index.js +672 -362
- package/dist/index.js.map +1 -1
- package/dist/worker.js +362 -343
- package/dist/worker.js.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -241,6 +241,18 @@ Measured on an Apple M2, single threaded:
|
|
|
241
241
|
`defineSpot` reports the projected cost before anything is allocated, and refuses a spot
|
|
242
242
|
over `maxBytes` with concrete suggestions. `maxCombos` caps range width.
|
|
243
243
|
|
|
244
|
+
### WebAssembly engine
|
|
245
|
+
|
|
246
|
+
The traversal runs in WebAssembly (`assembly/engine.ts`): 32-bit vectors and storage,
|
|
247
|
+
SIMD on every contiguous row, card sums and showdown sweeps in 64-bit. Its storage lives
|
|
248
|
+
in its own memory and the rest of the solver reads it through views, so every query,
|
|
249
|
+
warm start and analysis works unchanged. With threads (Node), all of them share one
|
|
250
|
+
WebAssembly memory and split the runouts as below. It runs wherever it can — 32-bit
|
|
251
|
+
storage, the default, and WebAssembly SIMD, which current Node and browsers have —
|
|
252
|
+
and `run.engine` says which ran. `engine: 'js'` forces the JavaScript traversal;
|
|
253
|
+
`precision: 'f64'` or `'i16'` use it too. Against the JavaScript traversal it is about
|
|
254
|
+
2.4× faster per iteration, and about 3× in Chromium.
|
|
255
|
+
|
|
244
256
|
### SIMD kernels
|
|
245
257
|
|
|
246
258
|
Regret matching and the average-strategy pass — the per-hand normalisation at every
|
|
@@ -320,8 +332,10 @@ deterministic at any thread count.
|
|
|
320
332
|
|
|
321
333
|
### Algorithm and benchmark
|
|
322
334
|
|
|
323
|
-
The default update rule is Discounted CFR (`algorithm: 'dcfr'`, α 1.5, β 0, γ
|
|
324
|
-
|
|
335
|
+
The default update rule is Discounted CFR (`algorithm: 'dcfr'`, α 1.5, β 0, γ 3, with
|
|
336
|
+
positive regret counted from the second iteration so the uniform first iteration is
|
|
337
|
+
forgotten). CFR+ is still available as `algorithm: 'cfr+'`. The table below predates the
|
|
338
|
+
0.2.0 schedule, which needs 10–15% fewer iterations on flop and turn spots. `npm run bench` times a fixed river, turn, flop
|
|
325
339
|
and two-tone flop. Measured in a 4-core cloud container, seconds of solving to reach each
|
|
326
340
|
target (exploitability checks excluded):
|
|
327
341
|
|
|
@@ -336,6 +350,26 @@ The solver is compute-bound rather than memory-bound — a 150 MB flop streams i
|
|
|
336
350
|
accumulators at about 0.25 GB/s — so the cost of an iteration tracks the work in it, not
|
|
337
351
|
its bytes.
|
|
338
352
|
|
|
353
|
+
### Compared with postflop-solver
|
|
354
|
+
|
|
355
|
+
`npm run bench:compare` runs the same spots through this solver and
|
|
356
|
+
[b-inary/postflop-solver](https://github.com/b-inary/postflop-solver) (Rust, built
|
|
357
|
+
natively for the machine) at the same 32-bit precision, thread count and checking
|
|
358
|
+
schedule. It needs a Rust toolchain; postflop-solver is fetched at build time and never
|
|
359
|
+
bundled. Measured in a 4-core cloud container, time to 0.3% of pot:
|
|
360
|
+
|
|
361
|
+
| Spot | Threads | poker-flopsolve | postflop-solver | Ratio |
|
|
362
|
+
|---|---|---|---|---|
|
|
363
|
+
| Turn | 1 | 1.4 s | 0.9 s | 1.7× |
|
|
364
|
+
| Flop | 1 | 29.4 s | 18.5 s | 1.6× |
|
|
365
|
+
| Monotone flop | 1 | 9.5 s | 5.2 s | 1.8× |
|
|
366
|
+
| Turn | 4 | 0.5 s | 0.3 s | 2.0× |
|
|
367
|
+
| Flop | 4 | 9.1 s | 5.1 s | 1.8× |
|
|
368
|
+
| Monotone flop | 4 | 2.9 s | 1.4 s | 2.1× |
|
|
369
|
+
|
|
370
|
+
0.2.0, still in JavaScript, was 4–6× behind; the WebAssembly engine below is most of
|
|
371
|
+
the difference.
|
|
372
|
+
|
|
339
373
|
### Accuracy targets
|
|
340
374
|
|
|
341
375
|
`solve(spot, { targetPercent })` stops as soon as exploitability reaches that percentage of
|
|
@@ -433,10 +467,9 @@ type-checked, tested and built; if the `version` in `package.json` is not on npm
|
|
|
433
467
|
is published, with provenance. So a release is: bump `version`, merge to `main`. A push
|
|
434
468
|
that leaves the version alone publishes nothing.
|
|
435
469
|
|
|
436
|
-
It
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
builds, and says it skipped publishing.
|
|
470
|
+
It publishes by npm trusted publishing: npm trusts this repository's `publish.yml`
|
|
471
|
+
(set up under the package's settings on npmjs.com), the job proves who it is with GitHub's
|
|
472
|
+
OpenID Connect token, and no npm token is stored anywhere.
|
|
440
473
|
|
|
441
474
|
## License
|
|
442
475
|
|