poker-flopsolve 0.1.0 → 0.2.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/dist/index.d.ts CHANGED
@@ -293,6 +293,46 @@ interface TerminalScratch {
293
293
  readonly win: Float64Array;
294
294
  }
295
295
 
296
+ /**
297
+ * Hand-space index structures and terminal kernels.
298
+ *
299
+ * Purpose: let a traversal carry each player's reach and values as a dense
300
+ * vector over the hands that player can hold on the current board — entry `i`
301
+ * of their active list (`buildActiveLists` in cfr.ts) — instead of a sparse
302
+ * 1326-wide array reached through a list of live combinations. Every loop
303
+ * then runs `0..n` over contiguous memory.
304
+ *
305
+ * What a traversal needs to move between boards and to settle terminals:
306
+ *
307
+ * - At a deal, which parent hand each child hand is, for the stored board
308
+ * and for every real deal it stands for (relabelled by the orbit's map).
309
+ * Reach is gathered and values scatter-added through these.
310
+ * - At a fold, which opposing hand is the very same combination as each of
311
+ * mine, for the inclusion–exclusion that removes it.
312
+ *
313
+ * A showdown needs nothing here: on a final board the active lists are
314
+ * already sorted by strength, with each entry's strength and cards beside it.
315
+ */
316
+
317
+ /** Everything a hand-space traversal looks up. */
318
+ interface HandSpace {
319
+ /**
320
+ * Deals: for round `r`, orbit member `m` (an index into
321
+ * `runouts.orbitMap[r]`) and player `p`, `up` from `upStart[r][m * 2 + p]`
322
+ * holds, for each of the player's hands on the stored child board, the
323
+ * index of the parent-board hand it is — through the member's relabelling.
324
+ */
325
+ readonly upStart: readonly Int32Array[];
326
+ readonly up: Uint16Array;
327
+ /**
328
+ * Folds: for each list slot `(roundBase[r] + board) * 2 + p`, from
329
+ * `sameStart[slot]`, the index in the other player's list of each of this
330
+ * player's hands, or -1 where they cannot hold it.
331
+ */
332
+ readonly sameStart: Int32Array;
333
+ readonly same: Int32Array;
334
+ }
335
+
296
336
  /**
297
337
  * Vector CFR+ over a fixed board.
298
338
  *
@@ -325,7 +365,17 @@ interface PlayerIndex {
325
365
  }
326
366
  /** Slot offsets for every decision node. */
327
367
  interface Layout {
368
+ /**
369
+ * Where each decision node's storage starts. Its block on a board is
370
+ * `actions` rows of the owner's hands live there, in hand-list order —
371
+ * entry `i` of their active list — so a row is as long as that list and
372
+ * blocked hands take no room. See `blockBase`.
373
+ */
328
374
  readonly offset: Int32Array;
375
+ /** For each list slot `(roundBase[r] + board) * 2 + p`: rows before this board's. */
376
+ readonly rowStart: Int32Array;
377
+ /** First list index of each round, as `ActiveLists.roundBase`. */
378
+ readonly roundBase: Int32Array;
329
379
  /**
330
380
  * First block of each decision node, else -1. A block is one node on one
331
381
  * board — `actions * combosOfItsOwner` slots, exactly what one visit
@@ -364,6 +414,8 @@ interface Context {
364
414
  readonly chipScale: number;
365
415
  /** Which combinations each player can hold on each board. */
366
416
  readonly active: ActiveLists;
417
+ /** How hand-space vectors move between boards and meet at terminals. */
418
+ readonly hands: HandSpace;
367
419
  /**
368
420
  * Board completions still to come after each round, with four cards already
369
421
  * removed for the two hands. A hand that ends early would otherwise be
@@ -425,10 +477,19 @@ interface ActiveLists {
425
477
  * Hands that mirror each other on a board with symmetry left, whose
426
478
  * accumulators are kept equal, indexed by the same slot as `start`:
427
479
  * `ties[tieStart[slot]..tieStart[slot + 1]]` is a run of classes, each its
428
- * size then that many storage slots. Empty almost everywhere.
480
+ * size then that many positions in the board's hand list. Empty almost
481
+ * everywhere.
429
482
  */
430
483
  readonly tieStart: Int32Array;
431
484
  readonly ties: Int32Array;
485
+ /** Each entry's two cards, beside `list`. */
486
+ readonly cardA: Uint8Array;
487
+ readonly cardB: Uint8Array;
488
+ /**
489
+ * Each entry's strength on its final board, beside `list`; final-board
490
+ * lists are sorted by it. Zero elsewhere.
491
+ */
492
+ readonly strength: Int32Array;
432
493
  }
433
494
  declare const Mode: {
434
495
  readonly Train: 0;