poker-flopsolve 0.0.0-stage → 0.1.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.
@@ -0,0 +1,1050 @@
1
+ /**
2
+ * Card encoding for a standard 52-card deck.
3
+ *
4
+ * Purpose: the one place a card's integer form is decided.
5
+ *
6
+ * A card is `rank * 4 + suit`, with rank 0 = deuce and 12 = ace, and suit
7
+ * ordered `s h d c`. Rank-major means all four cards of a rank are adjacent.
8
+ *
9
+ * The evaluator wants a different shape — four 13-bit rank masks, one per suit
10
+ * — so {@link suitLanes} converts. Keeping the two representations separate is
11
+ * deliberate: the integer index is what ranges, blockers and array offsets use,
12
+ * and the lanes exist only for the duration of an evaluation.
13
+ */
14
+ declare const RANKS = 13;
15
+ declare const SUITS = 4;
16
+ declare const DECK = 52;
17
+ /** Distinct two-card combinations, `C(52, 2)`. */
18
+ declare const COMBOS = 1326;
19
+ /** Rank of a card, 0 = deuce, 12 = ace. */
20
+ declare function rankOf(card: number): number;
21
+ /** Suit of a card, 0..3 in `s h d c` order. */
22
+ declare function suitOf(card: number): number;
23
+ /** Card index from rank and suit. */
24
+ declare function cardOf(rank: number, suit: number): number;
25
+ /**
26
+ * Name a card, e.g. "As".
27
+ * @param card card index
28
+ */
29
+ declare function formatCard(card: number): string;
30
+ /** Name a list of cards, space separated. */
31
+ declare function formatCards(cards: Iterable<number>): string;
32
+ /**
33
+ * Parse a card name such as "As" or "th".
34
+ * @param name two characters, rank then suit
35
+ * @throws if the name is not a card
36
+ */
37
+ declare function parseCard(name: string): number;
38
+ /**
39
+ * Parse a board or hand written as "AsKh7d", "As Kh 7d" or "as kh 7d".
40
+ * @param text card names, optionally separated by spaces or commas
41
+ * @throws if any card is malformed or repeated
42
+ */
43
+ declare function parseCards(text: string): number[];
44
+ /**
45
+ * Pack cards into the four 13-bit rank masks the evaluator takes.
46
+ *
47
+ * @param cards card indices
48
+ * @param lanes destination of length 4; zeroed by this call
49
+ */
50
+ declare function suitLanes(cards: Iterable<number>, lanes: Int32Array): void;
51
+ /**
52
+ * Index of a two-card combination, in the same colex order the solver uses.
53
+ *
54
+ * For `a < b` this is `a + b(b-1)/2`, a dense bijection onto `0..1325`.
55
+ *
56
+ * @param a one card
57
+ * @param b the other card
58
+ */
59
+ declare function comboIndex(a: number, b: number): number;
60
+ /** The two cards of every combination, flat, `COMBOS * 2` entries ascending. */
61
+ declare const COMBO_CARDS: Uint8Array;
62
+ /**
63
+ * Per-suit rank masks for every combination, four entries each.
64
+ *
65
+ * The evaluator takes four masks, so combining a hand with a board is four ORs.
66
+ * Precomputing the hand half once removes it from the inner loop entirely.
67
+ */
68
+ declare const COMBO_LANES: Int32Array;
69
+ /** Name a combination, e.g. "AsKh". */
70
+ declare function formatCombo(combo: number): string;
71
+
72
+ /**
73
+ * Card relabellings, and the symmetries of a spot.
74
+ *
75
+ * Purpose: the one place a runout is identified with another.
76
+ *
77
+ * A map relabels cards — and with them every combination — so that a subgame
78
+ * after one card can stand for the subgame after another. For a suit
79
+ * permutation that fixes the board and both ranges this is exact: the two
80
+ * subgames are mirror images, so solving one solves both. Later abstractions
81
+ * (rank relabellings) reuse the same table and accept an approximation.
82
+ *
83
+ * Map 0 is always the identity.
84
+ */
85
+ /** Every relabelling in use, each as a card map and the combination map it induces. */
86
+ declare class CardMaps {
87
+ /** `card[m][x]`: what map `m` sends card `x` to. */
88
+ readonly card: Uint8Array[];
89
+ /** `combo[m][h]`: what map `m` sends combination `h` to. */
90
+ readonly combo: Uint16Array[];
91
+ private readonly known;
92
+ constructor();
93
+ /** Register a card map, returning its id; the same map always gets the same id. */
94
+ add(cardMap: Uint8Array): number;
95
+ /** The map that applies `first`, then `second`. */
96
+ then(first: number, second: number): number;
97
+ /** The inverse of a map, which must be a bijection. */
98
+ inverse(id: number): number;
99
+ }
100
+
101
+ /**
102
+ * Board completions.
103
+ *
104
+ * Purpose: the one place the cards still to come are enumerated and indexed.
105
+ *
106
+ * The board is given, so unlike a from-scratch solver there is nothing to deal
107
+ * before the first betting round. What remains is the turn, the river, or
108
+ * neither. Completions are ORDERED — the turn is known when turn betting
109
+ * happens, so `Kh` then `2c` is a different line from `2c` then `Kh`, even
110
+ * though the final board is the same.
111
+ *
112
+ * Boards at a round are stored densely and grouped by parent, so the children
113
+ * of one board are a contiguous range and a worker can own a contiguous slice.
114
+ *
115
+ * Suit symmetry folds mirror-image deals together: on a two-tone flop a club
116
+ * turn is a diamond turn with the suits swapped, so only one is stored, and it
117
+ * stands for both. `orbitStart` and friends record which real deals each
118
+ * stored board stands for and how to relabel hands onto it.
119
+ */
120
+
121
+ /** Boards visible at each betting round. */
122
+ interface Runouts {
123
+ /** Betting rounds: 3 from a flop, 2 from a turn, 1 from a river. */
124
+ readonly rounds: number;
125
+ /** Cards on the board at each round: 3, 4, 5. */
126
+ readonly width: readonly number[];
127
+ /** Distinct boards stored at each round; always 1 at round 0. */
128
+ readonly counts: readonly number[];
129
+ /** Flat board cards per round, `counts[r] * width[r]` entries. */
130
+ readonly cards: readonly Uint8Array[];
131
+ /**
132
+ * Children of each board, as a prefix: the boards at round `r` dealt from
133
+ * board `p` of round `r - 1` are `childStart[r][p]` to
134
+ * `childStart[r][p + 1]`. Empty at round 0.
135
+ */
136
+ readonly childStart: readonly Int32Array[];
137
+ /** Each board's parent at the round before; -1 at round 0. */
138
+ readonly parent: readonly Int32Array[];
139
+ /**
140
+ * The real deals each stored board stands for, as a prefix into
141
+ * `orbitMap`/`orbitCard`: board `b` of round `r` stands for members
142
+ * `orbitStart[r][b]` to `orbitStart[r][b + 1]`. Member 0 is the board
143
+ * itself under the identity. Another member is a card that could have been
144
+ * dealt instead, with the map that sends it — and every combination with
145
+ * it — onto this board; the map fixes the parent board. Without symmetry
146
+ * every board stands only for itself.
147
+ */
148
+ readonly orbitStart: readonly Int32Array[];
149
+ readonly orbitMap: readonly Int32Array[];
150
+ readonly orbitCard: readonly Uint8Array[];
151
+ /**
152
+ * The symmetries each stored board still has, as a prefix into
153
+ * `stabiliserMap`: map ids, identity first. A board with more than the
154
+ * identity holds hands that mirror each other on it, whose strategies the
155
+ * solver keeps tied together.
156
+ */
157
+ readonly stabiliserStart: readonly Int32Array[];
158
+ readonly stabiliserMap: readonly Int32Array[];
159
+ /** The relabellings `orbitMap` refers to. */
160
+ readonly maps: CardMaps;
161
+ /** Whether any board stands for more than itself. */
162
+ readonly symmetric: boolean;
163
+ /**
164
+ * Whether some board stands for deals that are not its exact mirror
165
+ * images — runout buckets — so the stored game approximates the real one.
166
+ */
167
+ readonly approximate: boolean;
168
+ /** The board as given. */
169
+ readonly initial: readonly number[];
170
+ }
171
+ /** A real board, as the solver stores it. */
172
+ interface ResolvedBoard {
173
+ readonly round: number;
174
+ /** The stored board standing for it. */
175
+ readonly board: number;
176
+ /**
177
+ * Real combination to stored combination: a hand `h` on the real board
178
+ * plays as `combos[h]` on the stored one. The identity without symmetry.
179
+ */
180
+ readonly combos: Uint16Array;
181
+ }
182
+
183
+ /**
184
+ * Postflop betting tree.
185
+ *
186
+ * Purpose: the one place betting structure is decided — which actions exist,
187
+ * what they cost, when a street ends, and where the hand terminates.
188
+ *
189
+ * Unlike a from-scratch solver there are no blinds and no preflop: the spot
190
+ * starts with a dead pot and both players even. Each betting round opens with
191
+ * the out-of-position player.
192
+ *
193
+ * Payoffs are measured against a baseline where the dead pot is split, which is
194
+ * what makes the game zero-sum. Winning a showdown in which each player put in
195
+ * `c` is worth `pot / 2 + c`; when someone folds it is `pot / 2 +` whatever the
196
+ * folder had already put in. All amounts are integer units (chips * chipScale).
197
+ */
198
+
199
+ /**
200
+ * One available bet size: a fraction of the pot after calling, absolute chips,
201
+ * a multiple of the bet being faced (raises only), or a shove.
202
+ */
203
+ type BetSize = number | {
204
+ chips: number;
205
+ } | {
206
+ times: number;
207
+ } | 'allin';
208
+ /** Sizes offered when facing a bet: one row for every round, or a row per round. */
209
+ type RaiseSizes = readonly BetSize[] | readonly (readonly BetSize[])[];
210
+ declare const NodeKind: {
211
+ readonly Decision: 0;
212
+ readonly Chance: 1;
213
+ readonly TerminalFold: 2;
214
+ readonly TerminalShowdown: 3;
215
+ };
216
+ declare const ActionKind: {
217
+ readonly Fold: 0;
218
+ readonly Check: 1;
219
+ readonly Call: 2;
220
+ readonly Bet: 3;
221
+ readonly Raise: 4;
222
+ readonly AllIn: 5;
223
+ };
224
+ declare const ACTION_LABELS: readonly ["fold", "check", "call", "bet", "raise", "allin"];
225
+ /** Structure-of-arrays betting tree. */
226
+ interface Tree {
227
+ readonly nodeCount: number;
228
+ readonly edgeCount: number;
229
+ readonly kind: Uint8Array;
230
+ /** Player to act at a decision node, else -1. 0 is out of position. */
231
+ readonly player: Int8Array;
232
+ readonly round: Uint8Array;
233
+ readonly firstEdge: Int32Array;
234
+ readonly numEdges: Uint8Array;
235
+ /** Total in the middle at this node, in units, including the dead pot. */
236
+ readonly pot: Int32Array;
237
+ /**
238
+ * TerminalFold: value to player 0, signed, in units.
239
+ * TerminalShowdown: what the winner gains, in units.
240
+ */
241
+ readonly payoff: Int32Array;
242
+ readonly edgeAction: Uint8Array;
243
+ /** The actor's total investment after acting, in units. */
244
+ readonly edgeTarget: Int32Array;
245
+ readonly edgeChild: Int32Array;
246
+ readonly decisionNodes: Int32Array;
247
+ }
248
+
249
+ /**
250
+ * Terminal-node value kernels.
251
+ *
252
+ * Purpose: the one place showdowns and folds become per-hand counterfactual
253
+ * values, with exact card removal.
254
+ *
255
+ * Card removal is what makes this hard: two players cannot hold the same card,
256
+ * so summing an opponent's range naively over-counts. Inclusion-exclusion over
257
+ * the subsets of a hand's own cards fixes it exactly. With two hole cards there
258
+ * are three subsets — each card alone, and the pair — so
259
+ *
260
+ * blocked(hand) = S[a] + S[b] - S[{a,b}]
261
+ *
262
+ * where S[T] is the reach summed over hands containing every card of T. The
263
+ * two-card term is indexed at `52 + combo`, because a combination IS its own
264
+ * two-card subset.
265
+ *
266
+ * Showdown is two passes over strength-ordered hands: ascending accumulates
267
+ * what each hand beats, descending what it loses to. Ties need no special case
268
+ * — a hand's own tie group is committed only after the group is queried, so
269
+ * equal-strength hands and the hand itself fall out of both sums.
270
+ */
271
+
272
+ /** Strength ordering, for one final board, of the combinations that matter. */
273
+ interface ShowdownTable {
274
+ /** Final-round boards this covers. */
275
+ readonly boards: number;
276
+ /** Entries reserved per board: the size of the two ranges' union. */
277
+ readonly stride: number;
278
+ /** `boards * stride`: live combinations, ascending by strength. */
279
+ readonly order: Uint16Array;
280
+ /** Live combinations per board. */
281
+ readonly liveCount: Uint16Array;
282
+ /** `boards * (COMBOS + 1)`: tie-group boundaries into `order`. */
283
+ readonly groupStart: Uint16Array;
284
+ /** Tie groups per board. */
285
+ readonly groupCount: Uint16Array;
286
+ readonly bytes: number;
287
+ }
288
+ /** Reusable buffers, so the hot loop never allocates. */
289
+ interface TerminalScratch {
290
+ readonly weaker: Float64Array;
291
+ readonly stronger: Float64Array;
292
+ readonly all: Float64Array;
293
+ readonly win: Float64Array;
294
+ }
295
+
296
+ /**
297
+ * Vector CFR+ over a fixed board.
298
+ *
299
+ * Purpose: the one place equilibrium computation happens.
300
+ *
301
+ * Every traversal carries vectors over all 1326 combinations, so one walk of
302
+ * the tree updates every hand at once. Returned values are counterfactual — the
303
+ * opponent's reach is already folded in — which is exactly what the regret
304
+ * update expects, so nothing is rescaled anywhere.
305
+ *
306
+ * Values are UNNORMALISED: summed over runouts rather than averaged. CFR is
307
+ * invariant to a positive scale, and dividing once at the top by the total
308
+ * weighted mass of legal matchups is both cheaper and harder to get wrong than
309
+ * threading a probability through every node.
310
+ *
311
+ * Storage is sized by each player's own range, not by all 1326 combinations —
312
+ * a decision node belongs to one player, and a typical range is a few hundred
313
+ * hands, so this is the difference between fitting and not.
314
+ */
315
+
316
+ /** Which combinations a player holds, and where each sits in storage. */
317
+ interface PlayerIndex {
318
+ /** Combinations with any weight, ascending. */
319
+ readonly combos: Uint16Array;
320
+ readonly count: number;
321
+ /** Combination to storage slot, or -1. */
322
+ readonly slot: Int32Array;
323
+ /** Starting reach: the range weights themselves. */
324
+ readonly weights: Float64Array;
325
+ }
326
+ /** Slot offsets for every decision node. */
327
+ interface Layout {
328
+ readonly offset: Int32Array;
329
+ /**
330
+ * First block of each decision node, else -1. A block is one node on one
331
+ * board — `actions * combosOfItsOwner` slots, exactly what one visit
332
+ * updates — and block `blockOffset[node] + board` is where 16-bit storage
333
+ * keeps its scale.
334
+ */
335
+ readonly blockOffset: Int32Array;
336
+ readonly blocks: number;
337
+ readonly totalSlots: number;
338
+ readonly maxActions: number;
339
+ readonly bytes: number;
340
+ }
341
+ /** Accumulated regrets: float, or 16-bit integers scaled per block. */
342
+ type RegretStore = Float64Array | Float32Array | Int16Array;
343
+ /** Accumulated strategy sums: float, or 16-bit integers scaled per block. */
344
+ type SumStore = Float64Array | Float32Array | Uint16Array;
345
+ /** Everything a traversal needs. */
346
+ interface Context {
347
+ readonly tree: Tree;
348
+ readonly runouts: Runouts;
349
+ readonly players: readonly [PlayerIndex, PlayerIndex];
350
+ readonly layout: Layout;
351
+ readonly showdown: ShowdownTable;
352
+ readonly regret: RegretStore;
353
+ readonly strategySum: SumStore;
354
+ /**
355
+ * Per-block scales when the accumulators are 16-bit, else null: a stored
356
+ * integer `q` in block `b` means `q * scale[b]`. Only updates need them.
357
+ * Everything that reads a strategy divides each hand's values by their own
358
+ * total within one block, so the scale cancels and the integers are read
359
+ * as they are.
360
+ */
361
+ readonly regretScale: Float64Array | null;
362
+ readonly sumScale: Float64Array | null;
363
+ readonly scratch: TerminalScratch;
364
+ readonly chipScale: number;
365
+ /** Which combinations each player can hold on each board. */
366
+ readonly active: ActiveLists;
367
+ /**
368
+ * Board completions still to come after each round, with four cards already
369
+ * removed for the two hands. A hand that ends early would otherwise be
370
+ * counted once while one reaching showdown is counted once per runout.
371
+ */
372
+ readonly runoutWeight: Float64Array;
373
+ /** Total weighted mass of legal matchups; divides raw values into chips. */
374
+ readonly totalMass: number;
375
+ /** Discounted CFR in place of CFR+; see `DCFR_ALPHA`. */
376
+ readonly dcfr: boolean;
377
+ /**
378
+ * Runout range this traversal is responsible for, as [start, end), at
379
+ * `shardRound`. Workers each take a slice; a single-threaded solve takes
380
+ * the whole level. Runouts partition storage, so slices never collide.
381
+ */
382
+ shardStart: number;
383
+ shardEnd: number;
384
+ /** Round at which sharding applies; -1 to disable. */
385
+ shardRound: number;
386
+ /** Whether traverser nodes accumulate regret. False during a collect pass. */
387
+ applyUpdates: boolean;
388
+ /** Captures the reach a worker will need, instead of expanding. */
389
+ chanceCollect: ((node: number, reachMe: Float64Array, reachOpp: Float64Array) => void) | null;
390
+ /** Values to substitute for chance nodes at the shard round, by entry index. */
391
+ chanceOverride: Float64Array | null;
392
+ /** Node index to entry index for shard-round chance nodes, else -1. */
393
+ entryIndexOf: Int32Array | null;
394
+ /**
395
+ * How a stored board stands for the deals it represents. False: add its
396
+ * values relabelled, which is exact when reach is symmetric under the
397
+ * spot's symmetries — always so from the root, since the ranges are. True:
398
+ * walk it once per represented deal with that deal's reach relabelled
399
+ * onto it, exact for any reach, at the cost of the walks saved.
400
+ */
401
+ expandOrbits: boolean;
402
+ /** Use the WebAssembly SIMD kernels where the platform has them. */
403
+ readonly simd: boolean;
404
+ }
405
+ /**
406
+ * Which combinations each player can hold on each board.
407
+ *
408
+ * This depends only on the board and the player, never on the node, so
409
+ * rebuilding it at every one of the tens of thousands of node visits per
410
+ * traversal was pure repetition.
411
+ */
412
+ interface ActiveLists {
413
+ /** Start of each list in `list`, indexed by `slotOf(round, board, player)`. */
414
+ readonly start: Int32Array;
415
+ readonly count: Uint16Array;
416
+ readonly list: Uint16Array;
417
+ /**
418
+ * Each entry's storage slot in its player's index, beside `list`, so the
419
+ * hot loops read it in sequence instead of looking it up per combination.
420
+ */
421
+ readonly slot: Uint16Array;
422
+ /** First list index of each round. */
423
+ readonly roundBase: Int32Array;
424
+ /**
425
+ * Hands that mirror each other on a board with symmetry left, whose
426
+ * accumulators are kept equal, indexed by the same slot as `start`:
427
+ * `ties[tieStart[slot]..tieStart[slot + 1]]` is a run of classes, each its
428
+ * size then that many storage slots. Empty almost everywhere.
429
+ */
430
+ readonly tieStart: Int32Array;
431
+ readonly ties: Int32Array;
432
+ }
433
+ declare const Mode: {
434
+ readonly Train: 0;
435
+ readonly BestResponse: 1;
436
+ readonly Average: 2;
437
+ };
438
+ type Mode = (typeof Mode)[keyof typeof Mode];
439
+ /** A whole-tree traversal, returning the root value vector. */
440
+ type RootTraversal = (mode: Mode, traverser: 0 | 1, iterWeight: number) => Float64Array;
441
+ /** A prepared solver. */
442
+ interface Solver {
443
+ readonly ctx: Context;
444
+ /**
445
+ * One traversal for `traverser` on this thread alone, returning the root
446
+ * value vector.
447
+ */
448
+ traverseRoot(mode: Mode, traverser: 0 | 1, iterWeight: number): Float64Array;
449
+ /**
450
+ * Route the whole-tree traversals behind `iterate`, `expectedValue` and
451
+ * `exploitability` elsewhere — a worker pool — or back to `traverseRoot`
452
+ * with null.
453
+ */
454
+ useRoot(root: RootTraversal | null): void;
455
+ /** One chance node's subtree, honouring the context shard. */
456
+ traverseChance(mode: Mode, traverser: 0 | 1, iterWeight: number, node: number, reachMe: Float64Array, reachOpp: Float64Array): Float64Array;
457
+ /** Combinations live on the given board, shared by root and workers. */
458
+ readonly rootLive: Uint16Array;
459
+ readonly rootCount: number;
460
+ iterate(count: number, from: number): void;
461
+ expectedValue(): [number, number];
462
+ exploitability(): number;
463
+ averageStrategyAt(node: number, board: number): {
464
+ actions: number;
465
+ probs: Float64Array;
466
+ };
467
+ /**
468
+ * Counterfactual values under the average strategy from any node, for
469
+ * reach vectors the caller supplies. Returns a fresh copy.
470
+ */
471
+ valuesAt(node: number, board: number, traverser: 0 | 1, reachMe: Float64Array, reachOpp: Float64Array, live: Uint16Array, liveCount: number): Float64Array;
472
+ /**
473
+ * Counterfactual values under the average strategy from any node against
474
+ * each of `hands` alone, at the reach given for it: the same as `valuesAt`
475
+ * with a one-hot opponent reach, for many opposing hands in one walk.
476
+ * Returns `hands.length * COMBOS` values, one row per opposing hand.
477
+ */
478
+ pairValuesAt(node: number, board: number, traverser: 0 | 1, hands: Uint16Array, handReach: Float64Array, live: Uint16Array, liveCount: number): Float64Array;
479
+ }
480
+
481
+ /**
482
+ * Warm starts.
483
+ *
484
+ * Purpose: begin a solve from a previous one's regrets and strategy sums
485
+ * instead of from nothing.
486
+ *
487
+ * A tweaked spot — a different pot, a bet size nudged, a range reweighted —
488
+ * has nearly the same equilibrium as the one before, so starting there costs
489
+ * a fraction of the iterations. Nothing about the answer is approximate: CFR
490
+ * converges from any starting point, and this one is merely close.
491
+ *
492
+ * What carries over is the regrets — they ARE the current strategy, which is
493
+ * what a nearby equilibrium shares — and, only for the very same spot, the
494
+ * average strategy too, so a solve can be resumed exactly.
495
+ *
496
+ * The two trees are walked together from the root. A decision matches when
497
+ * the same player acts in the same round; its actions match by kind, and bets
498
+ * and raises by size as a fraction of the pot, the nearest within a factor of
499
+ * `SIZE_TOLERANCE`. Whatever matches nothing starts cold. Boards match by
500
+ * their real cards, so two spots may store different runouts (one folding
501
+ * mirrored deals, the other not); hands match by combination, so a range may
502
+ * have grown or shrunk.
503
+ */
504
+
505
+ /** What a warm start carried over. */
506
+ interface WarmStartReport {
507
+ /** Decision nodes of the new tree that found a match in the old one. */
508
+ readonly matchedNodes: number;
509
+ readonly decisionNodes: number;
510
+ /**
511
+ * Whether the average strategy was carried over too. Only for the very
512
+ * same spot: the average of another spot's iterations would have to be
513
+ * outweighed before the new spot's own could show, and measured, that
514
+ * costs more than it saves — a pot 20% bigger took 475 iterations to
515
+ * reach 0.1% of pot carrying it, 100 without, 125 from cold.
516
+ */
517
+ readonly averages: boolean;
518
+ }
519
+
520
+ /**
521
+ * Five-to-seven card hand evaluation.
522
+ *
523
+ * Purpose: turn a set of cards into a single integer whose order is hand
524
+ * strength, with exact equality for chops.
525
+ *
526
+ * Ported from the author's `poker-bitvaljs` (MIT), where the same routine is
527
+ * proven order-equivalent to a BigInt reference over all 2,598,960 five-card
528
+ * and all 133,784,560 seven-card hands. The port is re-verified here against an
529
+ * independent classifier rather than taken on trust — the original's evidence
530
+ * says nothing about whether this transcription is faithful.
531
+ *
532
+ * Input is four 13-bit rank masks, one per suit, which makes combining hole
533
+ * cards with a board four ORs. Output packs a category and five tiebreak
534
+ * nibbles into one int32:
535
+ *
536
+ * value = category * 16^5 + t1 * 16^4 + ... + t5
537
+ *
538
+ * Straight flushes of the same top rank in different suits compare EQUAL, which
539
+ * is correct poker and what a solver needs to score chops.
540
+ */
541
+ /** Hand categories, weakest first, matching the packed value's high digit. */
542
+ declare const CATEGORY: {
543
+ readonly highCard: 0;
544
+ readonly pair: 1;
545
+ readonly twoPair: 2;
546
+ readonly trips: 3;
547
+ readonly straight: 4;
548
+ readonly flush: 5;
549
+ readonly fullHouse: 6;
550
+ readonly quads: 7;
551
+ readonly straightFlush: 8;
552
+ };
553
+ declare const CATEGORY_NAMES: readonly ["high card", "pair", "two pair", "three of a kind", "straight", "flush", "full house", "four of a kind", "straight flush"];
554
+ /** Category of a packed value. */
555
+ declare function categoryOf(value: number): number;
556
+ /**
557
+ * Evaluate five to seven cards.
558
+ *
559
+ * Higher is stronger; equal values are exact chops. Behaviour is undefined for
560
+ * fewer than five cards — `high(0)` would return -1 and the kicker loops would
561
+ * read past the mask.
562
+ *
563
+ * @param s spade rank mask
564
+ * @param h heart rank mask
565
+ * @param d diamond rank mask
566
+ * @param c club rank mask
567
+ */
568
+ declare function evaluate(s: number, h: number, d: number, c: number): number;
569
+ /**
570
+ * Evaluate a list of cards, for tests and one-off calls.
571
+ *
572
+ * The solver never uses this — it keeps lanes around and ORs them — but it
573
+ * makes the evaluator usable without knowing the lane encoding.
574
+ *
575
+ * @param cards five to seven card indices
576
+ */
577
+ declare function evaluateCards(cards: ArrayLike<number>): number;
578
+
579
+ /**
580
+ * Weighted range parsing.
581
+ *
582
+ * Purpose: the one place range notation becomes solver input.
583
+ *
584
+ * A range is a dense `Float64Array` of 1326 weights, one per two-card
585
+ * combination, in the same colex order the solver indexes by. Weights rather
586
+ * than membership: a solver range is routinely partial ("call 40% of these"),
587
+ * and every downstream reach vector is a weight anyway.
588
+ *
589
+ * The notation follows common usage:
590
+ *
591
+ * AA KK-99 22+ pairs, ranges and "and better"
592
+ * AKs A2s+ A5s-A2s suited
593
+ * AKo KTo+ offsuit
594
+ * AK both suited and offsuit
595
+ * AsKh one exact combination
596
+ * Ax AXs AXo any second card, optionally constrained
597
+ * random everything
598
+ * AKo:0.5 any of the above at a partial weight
599
+ *
600
+ * `Xo` forms include the pair, because a pair is not suited; `Xs` forms do not.
601
+ */
602
+ /**
603
+ * Parse range notation into per-combination weights.
604
+ *
605
+ * Repeating a combination keeps the LAST weight given, so a narrowing segment
606
+ * can follow a broad one: `random:0.1, AA:1` is a light range with pure aces.
607
+ *
608
+ * @param notation comma-separated segments, each optionally `:weight`
609
+ * @returns weights indexed by combination, length 1326
610
+ */
611
+ declare function parseRange(notation: string): Float64Array;
612
+ /** Combinations carrying any weight. */
613
+ declare function activeCombos(weights: Float64Array): number[];
614
+ /** Total weight, i.e. combinations counted with their weight. */
615
+ declare function rangeWeight(weights: Float64Array): number;
616
+
617
+ /** Whether this platform runs the WebAssembly SIMD kernels; false means JavaScript throughout. */
618
+ declare function simdAvailable(): boolean;
619
+
620
+ /**
621
+ * Node platform.
622
+ *
623
+ * Purpose: the one place the solver touches Node-only APIs. A browser build
624
+ * swaps this module for `browser.ts`, which has the same exports; see
625
+ * `scripts/browser-platform.ts`.
626
+ */
627
+
628
+ /** Which build this is. */
629
+ declare const PLATFORM = "node";
630
+
631
+ /**
632
+ * Postflop Texas Hold'em solver.
633
+ *
634
+ * Purpose: the public surface. Give it a board, a pot, stacks, two ranges and a
635
+ * betting scheme; it solves to showdown.
636
+ *
637
+ * There is no preflop round. The ranges you supply already encode whatever spot
638
+ * you are in, so the solver starts from a dead pot with both players even.
639
+ */
640
+
641
+ /** A spot to solve. */
642
+ interface SpotConfig {
643
+ /** 3, 4 or 5 cards, e.g. "AsKh7d" or "As Kh 7d 2c". */
644
+ readonly board: string;
645
+ /** Dead money already in the middle, in chips. */
646
+ readonly pot: number;
647
+ /** Effective stack behind, per player, in chips. */
648
+ readonly stack: number;
649
+ /**
650
+ * The out-of-position player's range, who acts first: range notation, or
651
+ * a weight per combination indexed like `COMBO_CARDS`, as
652
+ * `Solution.subgameAt` produces.
653
+ */
654
+ readonly oop: string | Float64Array;
655
+ /** The in-position player's range, in either form. */
656
+ readonly ip: string | Float64Array;
657
+ /** Bet sizes per betting round; a single row applies to every round. */
658
+ readonly betSizes: readonly (readonly BetSize[])[];
659
+ /**
660
+ * Sizes offered when facing a bet; unset, raises use the bet sizes. One
661
+ * row for every round, or a row per round like `betSizes`.
662
+ */
663
+ readonly raiseSizes?: RaiseSizes;
664
+ /**
665
+ * Maximum aggressive actions per round; the opening bet is the first.
666
+ * One number, or one per round. Default 1.
667
+ */
668
+ readonly maxRaises?: number | readonly number[];
669
+ /** Offer a shove alongside the configured sizes; once, or per round. Default false. */
670
+ readonly allowAllIn?: boolean | readonly boolean[];
671
+ /**
672
+ * Turn a bet or raise into a shove when it would commit at least this
673
+ * fraction of the actor's remaining stack — 0.67 makes any bet of two
674
+ * thirds of what is left an all-in. Trims the near-all-in lines that
675
+ * multiply a tree for little strategic difference. Once, or per round.
676
+ * Unset, never.
677
+ */
678
+ readonly allInThreshold?: number | readonly number[];
679
+ /**
680
+ * Forbid donk bets: out of position may only check when opening a round
681
+ * into the player who made the last bet or raise of the round before.
682
+ * Once, or per round. Default false.
683
+ */
684
+ readonly noDonk?: boolean | readonly boolean[];
685
+ /**
686
+ * Collapse pot-fraction sizes closer together than this into their mean:
687
+ * with 0.1, sizes 0.33 and 0.4 become one 0.365. Default 0, none.
688
+ */
689
+ readonly mergeSizes?: number;
690
+ /** Refuse a range wider than this many combinations. */
691
+ readonly maxCombos?: number;
692
+ /**
693
+ * Drop combinations weighted below this from both ranges. Imported ranges
694
+ * are often full of hands at a few percent that barely move the answer
695
+ * but cost as much as any other; this removes them. It edits the ranges,
696
+ * so it changes the game being solved. Default 0, keep everything.
697
+ */
698
+ readonly minWeight?: number;
699
+ /**
700
+ * Refuse a spot needing more than this much storage. Defaults to 6 GiB in
701
+ * the Node build and 512 MiB in the browser build, where a tab has far less
702
+ * to give.
703
+ */
704
+ readonly maxBytes?: number;
705
+ readonly chipScale?: number;
706
+ /**
707
+ * Fold mirror-image runouts together. When the board and both ranges are
708
+ * unchanged by swapping some suits — two suits absent from a two-tone flop,
709
+ * three from a monotone one — a deal in one of those suits is the mirror
710
+ * image of a deal in another, so only one is solved and it stands for both.
711
+ * Exact, not an approximation: strategies on a mirrored runout are the
712
+ * stored ones relabelled. Default true; ranges that differ between suits
713
+ * anywhere simply have no symmetry to use.
714
+ */
715
+ readonly isomorphism?: boolean;
716
+ /**
717
+ * Solve one turn or river card for several that play alike — an
718
+ * approximation. Two cards of one suit are bucketed together when neither
719
+ * pairs the board, they connect equally to its straights, and swapping
720
+ * their ranks maps each range onto itself (so `98s` in a range keeps an 8
721
+ * and a 9 apart). The stored card stands for the others with hands
722
+ * relabelled by that swap. How much it saves depends on the ranges: with
723
+ * pairs and broadway hands most low cards bucket together; suited
724
+ * connectors keep them apart. `trueExploitabilityPercent()` measures the
725
+ * strategy in the real game, every card dealt. Default false.
726
+ */
727
+ readonly runoutBuckets?: boolean | number;
728
+ }
729
+ /** Projected cost of solving a spot. */
730
+ interface Estimate {
731
+ readonly rounds: number;
732
+ /**
733
+ * Final boards stored. With `isomorphism` a mirrored runout is not
734
+ * stored, so this can be well under the number of real runouts.
735
+ */
736
+ readonly runouts: number;
737
+ readonly combos: readonly [number, number];
738
+ readonly decisionNodes: number;
739
+ readonly totalSlots: number;
740
+ /** Storage at 32-bit precision, the default for any sizeable spot. */
741
+ readonly bytes: number;
742
+ /**
743
+ * Storage at 16-bit precision, a little over half of `bytes`; what a spot
744
+ * that does not fit at 32 bits is solved with.
745
+ */
746
+ readonly compressedBytes: number;
747
+ readonly secondsPerThousandIterations: number;
748
+ /** Whether the spot fits `maxBytes` at 16 bits or better. */
749
+ readonly fits: boolean;
750
+ readonly suggestions: readonly string[];
751
+ }
752
+ /** Thrown when a spot would need more memory than allowed. */
753
+ declare class SpotTooLargeError extends Error {
754
+ readonly estimate: Estimate;
755
+ constructor(estimate: Estimate, maxBytes: number);
756
+ }
757
+ /** A prepared spot, ready to solve. */
758
+ interface Spot {
759
+ readonly board: number[];
760
+ readonly tree: Tree;
761
+ readonly runouts: Runouts;
762
+ readonly players: readonly [PlayerIndex, PlayerIndex];
763
+ readonly estimate: Estimate;
764
+ readonly chipScale: number;
765
+ readonly potUnits: number;
766
+ readonly stackUnits: number;
767
+ /** The configuration this was built from, so a worker can rebuild it. */
768
+ readonly source: SpotConfig;
769
+ /**
770
+ * Find the stored board standing for a real one, and how hands relabel
771
+ * onto it. Board indices everywhere else — `strategyAt`, `reachAt`,
772
+ * `subgameAt` — index stored boards; with `isomorphism` a mirrored runout
773
+ * is not stored, and this is how to read it.
774
+ *
775
+ * @param board the spot's board followed by the cards dealt, in order
776
+ */
777
+ resolveBoard(board: string | readonly number[]): ResolvedBoard;
778
+ }
779
+ /**
780
+ * Validate a spot and build everything needed to solve it.
781
+ * @throws {SpotTooLargeError} when it would exceed the memory ceiling
782
+ */
783
+ declare function defineSpot(config: SpotConfig): Spot;
784
+ /** Solver tuning. */
785
+ interface SolveOptions {
786
+ /**
787
+ * Iterations to run. With `targetPercent` set this is only a cap, and the
788
+ * solve normally stops well before it; `stoppedAt` on the result says which
789
+ * of the two ended it.
790
+ */
791
+ readonly iterations?: number;
792
+ /**
793
+ * Stop once exploitability falls to this percentage of the pot — the
794
+ * accuracy knob, and the cheapest way to cut solve time.
795
+ *
796
+ * Solvers conventionally quote accuracy this way, and it is the only form
797
+ * comparable between spots of different sizes. As a rough guide, 1% of pot
798
+ * is a sketch, 0.5% is enough to read strategies off, 0.1% is publishable
799
+ * and costs several times as long.
800
+ *
801
+ * Checking is not free — see `exploitEvery` — so the solve overshoots the
802
+ * target slightly rather than stopping on the exact iteration it was met.
803
+ */
804
+ readonly targetPercent?: number;
805
+ /**
806
+ * Measure exploitability every N iterations. Each costs about one iteration,
807
+ * because it is a full best-response pass for both players.
808
+ *
809
+ * Left unset with `targetPercent` given, checks are scheduled by predicting
810
+ * when the target will be met rather than at any fixed cadence — see
811
+ * `nextCheck`. Setting this forces a fixed cadence instead.
812
+ */
813
+ readonly exploitEvery?: number;
814
+ readonly onProgress?: (info: Progress) => void;
815
+ /**
816
+ * Accumulator storage. Unset, a small spot uses 'f64', a larger one 'f32',
817
+ * and one too big for either under the spot's `maxBytes` uses 'i16'.
818
+ *
819
+ * 'i16' stores regrets and strategy sums as 16-bit integers with one scale
820
+ * per node and board, about halving memory. It is for fitting a spot, not
821
+ * for speed: the solver is compute-bound, and re-encoding each block on
822
+ * update costs a little time per iteration.
823
+ */
824
+ readonly precision?: Precision;
825
+ /**
826
+ * Threads to split the runouts across, the calling thread included: 2 is
827
+ * the caller and one worker. 1 stays single-threaded; 'auto' picks a count
828
+ * from the machine. Exploitability and EV passes use them too.
829
+ *
830
+ * A fixed worker count is bitwise deterministic, but CHANGING it moves the
831
+ * answer slightly: a worker sums its own slice of runouts before the totals
832
+ * are summed across workers, which associates the same addition
833
+ * differently, and the non-linear clamp in CFR+ compounds that rounding.
834
+ * Measured here it sits at 1e-15 through three hundred iterations and
835
+ * reaches 1e-7 by two thousand — always orders of magnitude under the
836
+ * exploitability, so never the largest error in the answer, but do not
837
+ * expect two worker counts to agree bit for bit.
838
+ *
839
+ * The browser build is single-threaded: any count resolves to 1 there.
840
+ */
841
+ readonly workers?: number | 'auto';
842
+ /**
843
+ * The update rule. 'dcfr' (the default) is Discounted CFR, which discounts
844
+ * old regrets and weights recent iterations more heavily; measured, it
845
+ * reaches 0.3% of pot in 35–45% fewer iterations than 'cfr+' on river,
846
+ * turn and flop spots alike. 'cfr+' clamps regrets at zero and weights
847
+ * iteration `t` by `t` in the average.
848
+ *
849
+ * Predictive Discounted CFR+ (Xu et al., 2024) was implemented and measured
850
+ * against 'dcfr' and is not offered: at the paper's parameters (α 2.3,
851
+ * γ 5) it took 165 iterations to 0.3% of pot on the bench turn spot where
852
+ * 'dcfr' takes 85, and 120 to 65 on the river; no α, γ tried (1 to 2.3, 2
853
+ * to 5) came close, with or without the prediction.
854
+ */
855
+ readonly algorithm?: Algorithm;
856
+ /**
857
+ * Allocate only the strategy sums, for loading a saved strategy and
858
+ * analysing it. Such a run must never be stepped.
859
+ */
860
+ readonly analysisOnly?: boolean;
861
+ /**
862
+ * Start from a previous solve of the same board instead of from nothing.
863
+ *
864
+ * For re-solving a tweaked spot — another pot or stack, a bet size nudged,
865
+ * a range reweighted — whose equilibrium is close to the old one. The
866
+ * answer is not approximate: CFR converges from any start, and this one is
867
+ * near. Nodes match by the actions leading to them, bet sizes by the
868
+ * nearest pot fraction; hands by combination; anything without a match
869
+ * starts cold. `SolveRun.warmStart` says how much matched.
870
+ *
871
+ * Regrets carry over; the average strategy only when the spot is the
872
+ * same, which resumes a solve exactly. Measured on a river spot re-solved
873
+ * to 0.1% of pot, a nudged bet size took 15 iterations instead of 130 from
874
+ * cold, a reweighted range 80 instead of 130, a 20% bigger pot 100
875
+ * instead of 125.
876
+ */
877
+ readonly warmStart?: Solution | SolveRun;
878
+ /**
879
+ * The iteration to carry on counting from, which sets how heavily DCFR
880
+ * discounts the inherited regrets and how CFR+ weights the averages. Unset,
881
+ * the old solve's own count: the new solve continues it. Lower it to let
882
+ * the new spot's own iterations outweigh the old ones sooner.
883
+ */
884
+ readonly warmIteration?: number;
885
+ /**
886
+ * Approximations that keep the game but solve it more cheaply. All off by
887
+ * default. Each costs some accuracy, which the exploitability — measured
888
+ * exactly, in the full game — shows.
889
+ */
890
+ readonly approximations?: Approximations;
891
+ /**
892
+ * Use the WebAssembly SIMD kernels where the platform supports them,
893
+ * falling back to JavaScript where it does not. Results are identical
894
+ * either way, to the bit; this exists to compare the two. Default true.
895
+ */
896
+ readonly simd?: boolean;
897
+ }
898
+ /** See `SolveOptions.approximations`. */
899
+ interface Approximations {
900
+ }
901
+ type Algorithm = 'cfr+' | 'dcfr';
902
+ type Precision = 'f64' | 'f32' | 'i16';
903
+ /** Bytes per stored value at each precision. */
904
+ declare const PRECISION_BYTES: {
905
+ readonly f64: 8;
906
+ readonly f32: 4;
907
+ readonly i16: 2;
908
+ };
909
+ interface Progress {
910
+ readonly iteration: number;
911
+ readonly exploitability: number;
912
+ readonly elapsedMs: number;
913
+ }
914
+ /** A solved spot. */
915
+ interface Solution {
916
+ readonly spot: Spot;
917
+ /** Iterations this solve ran. */
918
+ readonly iterations: number;
919
+ /** Iterations behind the strategy, counting any a warm start inherited. */
920
+ readonly totalIterations: number;
921
+ /**
922
+ * Which stopping rule ended the solve. 'iterations' with a `targetPercent`
923
+ * set means the target was NOT reached and the answer is looser than asked
924
+ * for — worth surfacing rather than swallowing.
925
+ */
926
+ readonly stoppedAt: 'target' | 'iterations';
927
+ /** Worker threads the solve actually used, which 'auto' does not tell you. */
928
+ readonly workers: number;
929
+ /** The solver behind this solution, for analysis and warm starts. */
930
+ readonly solver: Solver;
931
+ /** Chips per hand for a player, under the average strategy. */
932
+ ev(player: 0 | 1): number;
933
+ /** Distance from equilibrium, in chips per hand. */
934
+ exploitability(): number;
935
+ /**
936
+ * Distance from equilibrium as a percentage of the pot, which is how
937
+ * solvers conventionally report it and the only form comparable between
938
+ * spots of different sizes.
939
+ */
940
+ exploitabilityPercent(): number;
941
+ /** Action probabilities for every combination this player holds. */
942
+ strategyAt(node: number, board: number): StrategyView;
943
+ /** Readable action path to a node. */
944
+ path(node: number): string;
945
+ /**
946
+ * How likely each combination is to reach a node on a board, for one
947
+ * player: their range weight times the probability of every action they
948
+ * took on the way, under the average strategy. Indexed by combination.
949
+ * The other player's actions do not enter: this is the player's own range
950
+ * at the node, not the joint probability of getting there.
951
+ */
952
+ reachAt(node: number, board: number, player: 0 | 1): Float64Array;
953
+ /**
954
+ * The spot that starts at a node: the board as dealt there, the pot and
955
+ * stacks as they stand, and each player's range as `reachAt` gives it.
956
+ * Defining and solving it re-solves that part of the game, typically with
957
+ * more bet sizes than the whole spot could afford.
958
+ *
959
+ * This is unsafe re-solving: the subgame is solved for the ranges that
960
+ * arrive, so its strategy can be exploited in ways the original solution
961
+ * did not allow for. It answers "how should these ranges play from here"
962
+ * well; it does not make the earlier streets any more accurate.
963
+ *
964
+ * @param node a decision that opens a betting round after the first, or the root
965
+ * @param board the board index at that node's round
966
+ * @param betting overrides; unset, the original spot's betting carries over
967
+ */
968
+ subgameAt(node: number, board: number, betting?: SubgameBetting): SpotConfig;
969
+ readonly history: readonly Progress[];
970
+ }
971
+ /** Betting for a subgame; anything unset keeps the original spot's. */
972
+ type SubgameBetting = Partial<Pick<SpotConfig, 'betSizes' | 'raiseSizes' | 'maxRaises' | 'allowAllIn' | 'allInThreshold' | 'noDonk' | 'mergeSizes' | 'maxCombos' | 'maxBytes'>>;
973
+ interface StrategyView {
974
+ readonly node: number;
975
+ readonly board: number;
976
+ readonly player: 0 | 1;
977
+ readonly actions: readonly string[];
978
+ readonly combos: Uint16Array;
979
+ /** Row-major `combos.length * actions.length`. */
980
+ readonly probs: Float64Array;
981
+ }
982
+ /** An in-progress solve the caller drives. */
983
+ interface SolveRun {
984
+ readonly spot: Spot;
985
+ /** Iterations completed so far, by this run; a warm start's are not counted. */
986
+ readonly completed: number;
987
+ /** Iterations behind the strategy, counting any a warm start inherited. */
988
+ readonly totalIterations: number;
989
+ /** What a warm start carried over, or null without one. */
990
+ readonly warmStart: WarmStartReport | null;
991
+ /** Run `count` more iterations. */
992
+ step(count: number): void;
993
+ /** Distance from equilibrium as a percentage of the pot. */
994
+ exploitabilityPercent(): number;
995
+ /**
996
+ * Exploitability in the real game, every card dealt, as a percentage of
997
+ * the pot. The same as `exploitabilityPercent()` unless `runoutBuckets`
998
+ * folded cards that are not exact mirror images; then the strategy is
999
+ * copied onto every real runout of an unbucketed spot and measured there,
1000
+ * which costs that spot's memory and one best-response pass over it.
1001
+ */
1002
+ trueExploitabilityPercent(): number;
1003
+ /** A view of the strategy as it stands; cheap, take a fresh one each time. */
1004
+ snapshot(history?: readonly Progress[], stoppedAt?: 'target' | 'iterations'): Solution;
1005
+ /** Release worker threads. Snapshots taken before this stay usable. */
1006
+ close(): void;
1007
+ /** Worker threads actually in use; 1 when single-threaded. */
1008
+ readonly workers: number;
1009
+ /** The underlying solver, for per-node analysis once solving is done. */
1010
+ readonly solver: Solver;
1011
+ }
1012
+ /**
1013
+ * Prepare a solve without running it.
1014
+ *
1015
+ * Stepping costs nothing over one long call — the work per iteration is
1016
+ * identical — and it is what lets a caller report progress or stop early while
1017
+ * keeping the partial answer.
1018
+ *
1019
+ * @param spot from {@link defineSpot}
1020
+ * @param options solver setup
1021
+ */
1022
+ declare function createRun(spot: Spot, options?: SolveOptions): SolveRun;
1023
+ /** View a buffer as regret storage of the given precision. */
1024
+ declare function makeRegretStore(precision: Precision, buffer: ArrayBuffer | SharedArrayBuffer): RegretStore;
1025
+ /** View a buffer as strategy-sum storage of the given precision. */
1026
+ declare function makeSumStore(precision: Precision, buffer: ArrayBuffer | SharedArrayBuffer): SumStore;
1027
+ /**
1028
+ * Solve a prepared spot.
1029
+ * @param spot from {@link defineSpot}
1030
+ * @param options solver tuning
1031
+ */
1032
+ declare function solve(spot: Spot, options?: SolveOptions): Solution;
1033
+ /**
1034
+ * Predict the iteration at which exploitability will reach `target`.
1035
+ *
1036
+ * CFR+ exploitability falls as roughly `C / T^p`, so two measurements pin both
1037
+ * constants and the crossing follows. This beats any fixed cadence badly enough
1038
+ * to be worth the eight lines: a check is a full best-response pass for both
1039
+ * players, as costly as an iteration.
1040
+ *
1041
+ * Returns 0 when the two points say nothing useful — equal values, a rise, or a
1042
+ * non-finite fit — and the caller falls back to stepping the gap up.
1043
+ *
1044
+ * Exported because the browser UI drives its own loop, to stay stoppable, and
1045
+ * should schedule its checks the same way rather than reinventing a cadence.
1046
+ * Unit-agnostic: `e1`, `e2` and `target` need only share units.
1047
+ */
1048
+ declare function predictCrossing(t1: number, e1: number, t2: number, e2: number, target: number): number;
1049
+
1050
+ export { ACTION_LABELS, ActionKind, type Algorithm, type Approximations, type BetSize, CATEGORY, CATEGORY_NAMES, COMBOS, COMBO_CARDS, COMBO_LANES, DECK, type Estimate, NodeKind, PLATFORM, PRECISION_BYTES, type Precision, type Progress, RANKS, type ResolvedBoard, SUITS, type Solution, type SolveOptions, type SolveRun, type Solver, type Spot, type SpotConfig, SpotTooLargeError, type StrategyView, type SubgameBetting, type WarmStartReport, activeCombos, cardOf, categoryOf, comboIndex, createRun, defineSpot, evaluate, evaluateCards, formatCard, formatCards, formatCombo, makeRegretStore, makeSumStore, parseCard, parseCards, parseRange, predictCrossing, rangeWeight, rankOf, simdAvailable, solve, suitLanes, suitOf };