@betorigami/game-calculations 9.0.0 → 9.0.2

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,1255 @@
1
+ import Big$1, { Big } from "big.js";
2
+ //#region src/cards/types.d.ts
3
+ export declare const MIN_CARD_VALUE = 0;
4
+ export declare const MAX_CARD_VALUE = 51;
5
+ export declare const CARD_VALUES: number[];
6
+ export declare const CARD_SUITS: readonly ["Spades", "Hearts", "Diamonds", "Clubs"];
7
+ export type CardSuit = (typeof CARD_SUITS)[number];
8
+ export declare const CARD_RANKS: readonly ["Ace", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King"];
9
+ export type CardRank = (typeof CARD_RANKS)[number];
10
+ export declare const FACE_CARD_RANKS: readonly CardRank[];
11
+ export type CardValue = (typeof CARD_VALUES)[number];
12
+ export type CardDto = {
13
+ rank: CardRank;
14
+ suit: CardSuit;
15
+ cardValue: CardValue;
16
+ };
17
+ export declare const CARD_SUIT_COLORS: Record<CardSuit, 'red' | 'black'>;
18
+ //#endregion
19
+ //#region src/errors/game.error.d.ts
20
+ export declare enum GameErrorCode {
21
+ UNSUPPORTED_EDGE = "UNSUPPORTED_EDGE",
22
+ INPUT_VALIDATION_ERROR = "INPUT_VALIDATION_ERROR"
23
+ }
24
+ export declare class GameError extends Error {
25
+ static createUnsupportedEdgeError(message: string): GameError;
26
+ static createValidationError(message: string): GameError;
27
+ static isGameError(error: unknown): error is GameError;
28
+ errorCode: GameErrorCode;
29
+ constructor(errorCode: GameErrorCode, message?: string);
30
+ }
31
+ //#endregion
32
+ //#region src/games/origami-game.d.ts
33
+ export declare enum OrigamiGame {
34
+ DICE = "DICE",
35
+ MINES = "MINES",
36
+ KENO = "KENO",
37
+ LIMBO = "LIMBO",
38
+ ADVANCED_DICE = "ADVANCED_DICE",
39
+ BACCARAT = "BACCARAT",
40
+ DIAMONDS = "DIAMONDS",
41
+ PLINKO = "PLINKO",
42
+ ROULETTE = "ROULETTE",
43
+ WHEEL = "WHEEL",
44
+ BLACKJACK = "BLACKJACK",
45
+ BLITZ = "BLITZ",
46
+ DARTS = "DARTS"
47
+ }
48
+ //#endregion
49
+ //#region src/games/game.d.ts
50
+ export interface Game {
51
+ gameId: OrigamiGame;
52
+ supportedEdgeConfigurations: [number, ...number[]];
53
+ }
54
+ //#endregion
55
+ //#region src/games/random.d.ts
56
+ export type Proof = {
57
+ proofHash: string;
58
+ proofString: string;
59
+ };
60
+ export type SingleRandomValue = {
61
+ value: number;
62
+ values: number[];
63
+ count: 1;
64
+ min: number;
65
+ max: number;
66
+ } & Proof;
67
+ export type MultipleRandomValues = {
68
+ values: number[];
69
+ count: number;
70
+ min: number;
71
+ max: number;
72
+ } & Proof;
73
+ export interface RandomNumberGenerator {
74
+ getRandomInt({ min, max }: {
75
+ min: number;
76
+ max: number;
77
+ }): SingleRandomValue;
78
+ getUniqueRandomInts({ min, max, count }: {
79
+ min: number;
80
+ max: number;
81
+ count: number;
82
+ }): MultipleRandomValues;
83
+ getRandomIntsWithReplacement({ min, max, count }: {
84
+ min: number;
85
+ max: number;
86
+ count: number;
87
+ }): MultipleRandomValues;
88
+ }
89
+ //#endregion
90
+ //#region src/games/payout.d.ts
91
+ /**
92
+ * A single exact payout amount from a game round.
93
+ *
94
+ * A round returns zero or more legs. Neither their order nor their count is
95
+ * significant: a leg is not tied to a particular bet, an amount may be zero,
96
+ * and the number of legs need not match the number of bets placed. The only
97
+ * supported operation is summing them.
98
+ *
99
+ * Amounts are gross — they include returned stake — and unrounded. Rounding to
100
+ * a currency's precision is the consuming service's decision, not this
101
+ * package's.
102
+ */
103
+ export type PayoutLeg = Readonly<{
104
+ amount: Big$1;
105
+ }>;
106
+ /**
107
+ * A round's payout, expressed as its constituent legs.
108
+ */
109
+ export type Payout = Readonly<{
110
+ legs: readonly PayoutLeg[];
111
+ }>;
112
+ /**
113
+ * Totals a round's payout.
114
+ *
115
+ * Summing the legs is lossless; reconstructing the total from a rounded
116
+ * payout multiplier is not, so this is the only supported way to arrive at
117
+ * what a round pays.
118
+ */
119
+ export declare const sumPayout: (payout: Payout) => Big$1;
120
+ //#endregion
121
+ //#region src/games/single-action-game.d.ts
122
+ export type EmptyGameOutput = {};
123
+ export interface GetGameResultRequest<TGameInputs> {
124
+ generator: RandomNumberGenerator;
125
+ edge: number;
126
+ gameInputs: TGameInputs;
127
+ }
128
+ export interface GameResult<TGameOutputs = EmptyGameOutput> {
129
+ isFinished: boolean;
130
+ payout: Payout;
131
+ payoutMultiplier: Big$1;
132
+ outputs: TGameOutputs & {
133
+ result: number[];
134
+ };
135
+ randomValues: SingleRandomValue | MultipleRandomValues;
136
+ }
137
+ export declare abstract class SingleActionGame<TGameInputs, TGameOutputs = EmptyGameOutput> implements Game {
138
+ readonly gameId: OrigamiGame;
139
+ protected constructor(gameId: OrigamiGame);
140
+ abstract get supportedEdgeConfigurations(): [number, ...number[]];
141
+ abstract getBetAmount(gameInputs: TGameInputs): Big$1;
142
+ getGameResult(request: GetGameResultRequest<TGameInputs>): GameResult<TGameOutputs>;
143
+ protected abstract determineGameResult(request: GetGameResultRequest<TGameInputs>): GameResult<TGameOutputs>;
144
+ }
145
+ //#endregion
146
+ //#region src/games/advanced-dice/advanced-dice.d.ts
147
+ export type Bounds = {
148
+ lower: number;
149
+ upper: number;
150
+ };
151
+ export declare const RANDOM_MIN_VALUE = 0;
152
+ export declare const RANDOM_MAX_VALUE = 10000;
153
+ export declare const EFFECTIVE_RANGE: number;
154
+ export declare const MIN_WIN_CHANCE = 0.01;
155
+ export declare const MAX_WIN_CHANCE = 98;
156
+ export declare const advancedDiceIsWithinBoundsInclusive: (bounds: Bounds, result: number) => boolean;
157
+ export declare const advancedDiceGetInclusiveBoundsRange: (bounds: Bounds) => number;
158
+ export declare const advancedDiceIsWithinBoundsExclusive: (bounds: Bounds, result: number) => boolean;
159
+ export declare const advancedDiceGetExclusiveBoundsRange: (bounds: Bounds) => number;
160
+ export declare enum RollType {
161
+ ROLL_BETWEEN = "ROLL_BETWEEN",
162
+ ROLL_OUTSIDE = "ROLL_OUTSIDE",
163
+ ROLL_BETWEEN_TWO = "ROLL_BETWEEN_TWO"
164
+ }
165
+ export type RollBetween = {
166
+ mode: RollType.ROLL_BETWEEN;
167
+ bounds: Bounds;
168
+ betAmount: Big;
169
+ };
170
+ export type RollOutside = {
171
+ mode: RollType.ROLL_OUTSIDE;
172
+ bounds: Bounds;
173
+ betAmount: Big;
174
+ };
175
+ export type RollBetweenTwo = {
176
+ mode: RollType.ROLL_BETWEEN_TWO;
177
+ firstBounds: Bounds;
178
+ secondBounds: Bounds;
179
+ betAmount: Big;
180
+ };
181
+ export type AdvancedDiceInputs = RollBetween | RollOutside | RollBetweenTwo;
182
+ export type AdvancedDiceSelection = Pick<RollBetween, 'mode' | 'bounds'> | Pick<RollOutside, 'mode' | 'bounds'> | Pick<RollBetweenTwo, 'mode' | 'firstBounds' | 'secondBounds'>;
183
+ export declare const calculateAdvancedDiceWinChance: (gameInputs: AdvancedDiceSelection) => Big;
184
+ export declare const validateAdvancedDiceInputs: (gameInputs: AdvancedDiceSelection) => void;
185
+ export declare class AdvancedDice extends SingleActionGame<AdvancedDiceInputs> {
186
+ constructor();
187
+ get supportedEdgeConfigurations(): [number, ...number[]];
188
+ getBetAmount(gameInputs: AdvancedDiceInputs): Big;
189
+ protected determineGameResult({ generator, edge, gameInputs }: GetGameResultRequest<AdvancedDiceInputs>): GameResult;
190
+ }
191
+ //#endregion
192
+ //#region src/games/baccarat/baccarat.d.ts
193
+ export interface Bet {
194
+ amount: Big$1;
195
+ type: BaccaratBetType;
196
+ }
197
+ export interface BaccaratGameInputs {
198
+ bets: Bet[];
199
+ }
200
+ export declare const VALID_SUITS: readonly ["Clubs", "Diamonds", "Hearts", "Spades"];
201
+ export declare const VALID_RANKS: readonly ["Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King"];
202
+ export type Suit = (typeof VALID_SUITS)[number];
203
+ export type Rank = (typeof VALID_RANKS)[number];
204
+ export interface Card {
205
+ suit: Suit;
206
+ rank: Rank;
207
+ }
208
+ export declare enum BaccaratOutcome {
209
+ PLAYER_WIN = "PLAYER_WIN",
210
+ TIE = "TIE",
211
+ BANKER_WIN = "BANKER_WIN"
212
+ }
213
+ export declare enum BaccaratBetType {
214
+ PLAYER = "PLAYER",
215
+ TIE = "TIE",
216
+ BANKER = "BANKER"
217
+ }
218
+ export interface BaccaratGameOutputs {
219
+ playerCards: Card[];
220
+ playerHandValue: number;
221
+ bankerCards: Card[];
222
+ bankerHandValue: number;
223
+ gameOutcome: BaccaratOutcome;
224
+ }
225
+ export declare const calculateBaccaratBetAmount: (gameInputs: BaccaratGameInputs) => Big$1;
226
+ export declare class Baccarat extends SingleActionGame<BaccaratGameInputs, BaccaratGameOutputs> {
227
+ constructor();
228
+ get supportedEdgeConfigurations(): [number, ...number[]];
229
+ getBetAmount(gameInputs: BaccaratGameInputs): Big$1;
230
+ protected determineGameResult({ generator, gameInputs }: GetGameResultRequest<BaccaratGameInputs>): GameResult<BaccaratGameOutputs>;
231
+ private validateGameInputs;
232
+ private mapRandomValueToCard;
233
+ private isNaturalWin;
234
+ private mapRandomValueToCardValue;
235
+ private shouldDrawThirdPlayerCard;
236
+ private shouldDrawThirdBankerCard;
237
+ }
238
+ //#endregion
239
+ //#region src/games/blackjack/blackjack.types.d.ts
240
+ export interface BlackjackHandDto {
241
+ cards: ReadonlyArray<CardDto>;
242
+ value: number;
243
+ }
244
+ export declare enum BlackjackOutcome {
245
+ WIN = "WIN",
246
+ LOSE = "LOSE",
247
+ PUSH = "PUSH",
248
+ PLAYER_BLACKJACK = "PLAYER_BLACKJACK"
249
+ }
250
+ export declare enum InsuranceOutcome {
251
+ WON = "WON",
252
+ LOST = "LOST"
253
+ }
254
+ export declare enum BlackjackActionType {
255
+ START = "START",
256
+ HIT = "BLACKJACK_HIT",
257
+ STAND = "BLACKJACK_STAND",
258
+ BUY_INSURANCE = "BLACKJACK_BUY_INSURANCE",
259
+ REJECT_INSURANCE = "BLACKJACK_REJECT_INSURANCE",
260
+ DOUBLE_DOWN = "BLACKJACK_DOUBLE_DOWN",
261
+ SPLIT = "BLACKJACK_SPLIT"
262
+ }
263
+ export declare enum PairBonusType {
264
+ EXACT_PAIR = "EXACT_PAIR",
265
+ COLORED_PAIR = "COLORED_PAIR",
266
+ MIXED_PAIR = "MIXED_PAIR",
267
+ LOSS = "LOSS"
268
+ }
269
+ export declare enum ThreeCardBonusType {
270
+ SUITED_TRIPS = "SUITED_TRIPS",
271
+ STRAIGHT_FLUSH = "STRAIGHT_FLUSH",
272
+ THREE_OF_A_KIND = "THREE_OF_A_KIND",
273
+ STRAIGHT = "STRAIGHT",
274
+ FLUSH = "FLUSH",
275
+ LOSS = "LOSS"
276
+ }
277
+ export type BetAmounts = Readonly<{
278
+ mainBetAmount: Big$1;
279
+ pairBonusAmount: Big$1;
280
+ threeCardBonusAmount: Big$1;
281
+ }>;
282
+ export type PairBonusResult = Readonly<{
283
+ betAmount: string;
284
+ payoutMultiplier: number;
285
+ result: PairBonusType;
286
+ }>;
287
+ export type ThreeCardBonusResult = Readonly<{
288
+ betAmount: string;
289
+ payoutMultiplier: number;
290
+ result: ThreeCardBonusType;
291
+ }>;
292
+ export type SideBetResults = Readonly<{
293
+ pairBonus: PairBonusResult | null;
294
+ threeCardBonus: ThreeCardBonusResult | null;
295
+ }>;
296
+ //#endregion
297
+ //#region src/games/blackjack/blackjack.constants.d.ts
298
+ export declare const BLACKJACK_MULTIPLIER = 2.5;
299
+ export declare const WIN_MULTIPLIER = 2;
300
+ export declare const PUSH_MULTIPLIER = 1;
301
+ export declare const LOSE_MULTIPLIER = 0;
302
+ export declare const DEALER_STAND_VALUE = 17;
303
+ export declare const BUST_VALUE = 21;
304
+ export declare const BLACKJACK_VALUE = 21;
305
+ export declare const MAX_CARDS_PER_ROUND = 63;
306
+ export declare const INSURANCE_BET_SIZE_FACTOR = 0.5;
307
+ export declare const INSURANCE_WIN_MULTIPLIER = 3;
308
+ export declare const DOUBLE_DOWN_BET_SIZE_FACTOR = 1;
309
+ export declare const SPLIT_BET_SIZE_FACTOR = 1;
310
+ export declare const CARDS_PER_SUIT = 13;
311
+ export declare const ACE_SOFT_BONUS = 10;
312
+ export declare const FACE_CARD_VALUE = 10;
313
+ export declare const BASE_PAYOUT_MULTIPLIERS: Record<BlackjackOutcome, number>;
314
+ export declare const PAIR_BONUS_PAYOUTS: Record<PairBonusType, number>;
315
+ export declare const THREE_CARD_BONUS_PAYOUTS: Record<ThreeCardBonusType, number>;
316
+ //#endregion
317
+ //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/primitive.d.ts
318
+ /**
319
+ Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
320
+
321
+ @category Type
322
+ */
323
+ type Primitive = null | undefined | string | number | boolean | symbol | bigint;
324
+ //#endregion
325
+ //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/internal/type.d.ts
326
+ /**
327
+ Matches any primitive, `void`, `Date`, or `RegExp` value.
328
+ */
329
+ type BuiltIns = Primitive | void | Date | RegExp;
330
+ /**
331
+ Test if the given function has multiple call signatures.
332
+
333
+ Needed to handle the case of a single call signature with properties.
334
+
335
+ Multiple call signatures cannot currently be supported due to a TypeScript limitation.
336
+ @see https://github.com/microsoft/TypeScript/issues/29732
337
+ */
338
+ type HasMultipleCallSignatures<T extends (...arguments_: any[]) => unknown> = T extends {
339
+ (...arguments_: infer A): unknown;
340
+ (...arguments_: infer B): unknown;
341
+ } ? B extends A ? A extends B ? false : true : true : false;
342
+ //#endregion
343
+ //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/simplify.d.ts
344
+ /**
345
+ Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
346
+
347
+ @example
348
+ ```
349
+ import type {Simplify} from 'type-fest';
350
+
351
+ type PositionProps = {
352
+ top: number;
353
+ left: number;
354
+ };
355
+
356
+ type SizeProps = {
357
+ width: number;
358
+ height: number;
359
+ };
360
+
361
+ // In your editor, hovering over `Props` will show a flattened object with all the properties.
362
+ type Props = Simplify<PositionProps & SizeProps>;
363
+ ```
364
+
365
+ Sometimes it is desired to pass a value as a function argument that has a different type. At first inspection it may seem assignable, and then you discover it is not because the `value`'s type definition was defined as an interface. In the following example, `fn` requires an argument of type `Record<string, unknown>`. If the value is defined as a literal, then it is assignable. And if the `value` is defined as type using the `Simplify` utility the value is assignable. But if the `value` is defined as an interface, it is not assignable because the interface is not sealed and elsewhere a non-string property could be added to the interface.
366
+
367
+ If the type definition must be an interface (perhaps it was defined in a third-party npm package), then the `value` can be defined as `const value: Simplify<SomeInterface> = ...`. Then `value` will be assignable to the `fn` argument. Or the `value` can be cast as `Simplify<SomeInterface>` if you can't re-declare the `value`.
368
+
369
+ @example
370
+ ```
371
+ import type {Simplify} from 'type-fest';
372
+
373
+ interface SomeInterface {
374
+ foo: number;
375
+ bar?: string;
376
+ baz: number | undefined;
377
+ }
378
+
379
+ type SomeType = {
380
+ foo: number;
381
+ bar?: string;
382
+ baz: number | undefined;
383
+ };
384
+
385
+ const literal = {foo: 123, bar: 'hello', baz: 456};
386
+ const someType: SomeType = literal;
387
+ const someInterface: SomeInterface = literal;
388
+
389
+ declare function fn(object: Record<string, unknown>): void;
390
+
391
+ fn(literal); // Good: literal object type is sealed
392
+ fn(someType); // Good: type is sealed
393
+ // @ts-expect-error
394
+ fn(someInterface); // Error: Index signature for type 'string' is missing in type 'someInterface'. Because `interface` can be re-opened
395
+ fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface` into a `type`
396
+ ```
397
+
398
+ @link https://github.com/microsoft/TypeScript/issues/15300
399
+ @see {@link SimplifyDeep}
400
+ @category Object
401
+ */
402
+ type Simplify<T> = { [KeyType in keyof T]: T[KeyType]; } & {};
403
+ //#endregion
404
+ //#region ../../node_modules/.pnpm/type-fest@5.9.0/node_modules/type-fest/source/readonly-deep.d.ts
405
+ /**
406
+ Create a deeply immutable version of another type.
407
+
408
+ This is useful when a deeply nested structure needs to be exposed as completely immutable, for example, an imported JSON module or when receiving an API response that is passed around.
409
+
410
+ Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/13923) if you want to have this type as a built-in in TypeScript.
411
+
412
+ Use [`Readonly<T>`](https://www.typescriptlang.org/docs/handbook/utility-types.html#readonlytype) if you only need one level deep.
413
+
414
+ @example
415
+ ```
416
+ import type {ReadonlyDeep} from 'type-fest';
417
+
418
+ declare const foo: {
419
+ a: string;
420
+ b: {c: number};
421
+ d: Array<{e: number}>;
422
+ };
423
+
424
+ foo.a = 'bar'; // Allowed
425
+
426
+ foo.b = {c: 3}; // Allowed
427
+
428
+ foo.b.c = 4; // Allowed
429
+
430
+ foo.d = [{e: 5}]; // Allowed
431
+
432
+ foo.d.push({e: 6}); // Allowed
433
+
434
+ const last = foo.d.at(-1);
435
+ if (last) {
436
+ last.e = 7; // Allowed
437
+ }
438
+
439
+ declare const readonlyFoo: ReadonlyDeep<typeof foo>;
440
+
441
+ // @ts-expect-error
442
+ readonlyFoo.a = 'bar';
443
+ // Error: Cannot assign to 'a' because it is a read-only property.
444
+
445
+ // @ts-expect-error
446
+ readonlyFoo.b = {c: 3};
447
+ // Error: Cannot assign to 'b' because it is a read-only property.
448
+
449
+ // @ts-expect-error
450
+ readonlyFoo.b.c = 4;
451
+ // Error: Cannot assign to 'c' because it is a read-only property.
452
+
453
+ // @ts-expect-error
454
+ readonlyFoo.d = [{e: 5}];
455
+ // Error: Cannot assign to 'd' because it is a read-only property.
456
+
457
+ // @ts-expect-error
458
+ readonlyFoo.d.push({e: 6});
459
+ // Error: Property 'push' does not exist on type 'ReadonlyArray<{readonly e: number}>'.
460
+
461
+ const readonlyLast = readonlyFoo.d.at(-1);
462
+ if (readonlyLast) {
463
+ // @ts-expect-error
464
+ readonlyLast.e = 8;
465
+ // Error: Cannot assign to 'e' because it is a read-only property.
466
+ }
467
+ ```
468
+
469
+ Note that types containing overloaded functions are not made deeply readonly due to a [TypeScript limitation](https://github.com/microsoft/TypeScript/issues/29732).
470
+
471
+ @category Object
472
+ @category Array
473
+ @category Set
474
+ @category Map
475
+ */
476
+ type ReadonlyDeep<T> = T extends BuiltIns ? T : T extends (new (...arguments_: any[]) => unknown) ? T // Skip class constructors
477
+ : T extends ((...arguments_: any[]) => unknown) ? {} extends _ReadonlyObjectDeep<T> ? T : HasMultipleCallSignatures<T> extends true ? T : ((...arguments_: Parameters<T>) => ReturnType<T>) & _ReadonlyObjectDeep<T> : T extends Readonly<ReadonlyMap<infer KeyType, infer ValueType>> ? ReadonlyMapDeep<KeyType, ValueType> : T extends Readonly<ReadonlySet<infer ItemType>> ? ReadonlySetDeep<ItemType> :
478
+ // Identify tuples to avoid converting them to arrays inadvertently; special case `readonly [...never[]]`, as it emerges undesirably from recursive invocations of ReadonlyDeep below.
479
+ T extends readonly [] | readonly [...never[]] ? readonly [] : T extends readonly [infer U, ...infer V] ? readonly [ReadonlyDeep<U>, ...ReadonlyDeep<V>] : T extends readonly [...infer U, infer V] ? readonly [...ReadonlyDeep<U>, ReadonlyDeep<V>] : T extends ReadonlyArray<infer ItemType> ? ReadonlyArray<ReadonlyDeep<ItemType>> : T extends object ? _ReadonlyObjectDeep<T> : unknown;
480
+ /**
481
+ Same as `ReadonlyDeep`, but accepts only `ReadonlyMap`s as inputs. Internal helper for `ReadonlyDeep`.
482
+ */
483
+ type ReadonlyMapDeep<KeyType, ValueType> = {} & Readonly<ReadonlyMap<ReadonlyDeep<KeyType>, ReadonlyDeep<ValueType>>>;
484
+ /**
485
+ Same as `ReadonlyDeep`, but accepts only `ReadonlySet`s as inputs. Internal helper for `ReadonlyDeep`.
486
+ */
487
+ type ReadonlySetDeep<ItemType> = {} & Readonly<ReadonlySet<ReadonlyDeep<ItemType>>>;
488
+ /**
489
+ Same as `ReadonlyDeep`, but accepts only `object`s as inputs. Internal helper for `ReadonlyDeep`.
490
+ */
491
+ type _ReadonlyObjectDeep<ObjectType extends object> = { readonly [KeyType in keyof ObjectType]: ReadonlyDeep<ObjectType[KeyType]>; };
492
+ //#endregion
493
+ //#region src/cards/card.d.ts
494
+ declare class Card$1 {
495
+ readonly value: CardValue;
496
+ constructor(rawValue: number);
497
+ get suit(): CardSuit;
498
+ get rank(): CardRank;
499
+ toDto(): CardDto;
500
+ }
501
+ //#endregion
502
+ //#region src/games/blackjack/card/blackjack-card.d.ts
503
+ declare class BlackjackCard extends Card$1 {
504
+ get numericRank(): number;
505
+ static fromValue(value: CardValue): BlackjackCard;
506
+ }
507
+ //#endregion
508
+ //#region src/games/blackjack/hand/blackjack-hand-value.d.ts
509
+ declare class BlackjackHandValue {
510
+ readonly cards: ReadonlyArray<BlackjackCard>;
511
+ readonly hardHandValue: number;
512
+ readonly softHandValue: number | null;
513
+ constructor(cards: ReadonlyArray<BlackjackCard>);
514
+ get cardCount(): number;
515
+ get hasSoftHandValue(): boolean;
516
+ get isBusted(): boolean;
517
+ get isBlackjack(): boolean;
518
+ get highestHandValue(): number;
519
+ }
520
+ //#endregion
521
+ //#region src/games/blackjack/hand/blackjack-hand.d.ts
522
+ declare abstract class BlackjackHand {
523
+ readonly cards: ReadonlyArray<BlackjackCard>;
524
+ protected readonly value: BlackjackHandValue;
525
+ protected constructor(rawCards: ReadonlyArray<CardValue>);
526
+ abstract addDrawnCards(newCards: ReadonlyArray<CardValue>): BlackjackHand;
527
+ get isBusted(): boolean;
528
+ get isBlackjack(): boolean;
529
+ get highestHandValue(): number;
530
+ get rawValues(): ReadonlyArray<CardValue>;
531
+ toDto(): BlackjackHandDto;
532
+ }
533
+ //#endregion
534
+ //#region src/games/blackjack/hand/dealer-hand.d.ts
535
+ declare class DealerHand extends BlackjackHand {
536
+ private readonly otherCards;
537
+ readonly upCard: BlackjackCard;
538
+ readonly holeCard: BlackjackCard;
539
+ private constructor();
540
+ static withInitialDeal(params: {
541
+ upCard: CardValue;
542
+ holeCard: CardValue;
543
+ }): DealerHand;
544
+ addDrawnCards(newCards: ReadonlyArray<CardValue>): DealerHand;
545
+ toDto(revealHoleCard?: boolean): BlackjackHandDto;
546
+ }
547
+ //#endregion
548
+ //#region src/games/blackjack/hand/player-hand.d.ts
549
+ declare class PlayerHand extends BlackjackHand {
550
+ static withInitialDeal(initialCards: readonly [CardValue, CardValue]): PlayerHand;
551
+ addDrawnCards(newCards: ReadonlyArray<CardValue>): PlayerHand;
552
+ }
553
+ //#endregion
554
+ //#region src/games/random-value-pool.d.ts
555
+ export declare class RandomValuePool {
556
+ private readonly source;
557
+ private index;
558
+ private constructor();
559
+ static from(result: MultipleRandomValues, count: number): RandomValuePool;
560
+ get consumedValues(): number[];
561
+ toMultipleRandomValues(): MultipleRandomValues;
562
+ takeOne(): number;
563
+ take(count: number): ReadonlyArray<number>;
564
+ }
565
+ //#endregion
566
+ //#region src/games/multi-action-game.d.ts
567
+ export type BaseInProgressState = Readonly<{
568
+ isFinished: false;
569
+ multiplier: Big$1;
570
+ }>;
571
+ export type BaseFinishedState = Readonly<{
572
+ isFinished: true;
573
+ payout: Payout;
574
+ multiplier: Big$1;
575
+ randomValues: number[];
576
+ }>;
577
+ export type BaseGameState = BaseInProgressState | BaseFinishedState;
578
+ export type GameContext<TAction, TState extends BaseGameState, TConfig> = {
579
+ readonly playerArgument: TAction;
580
+ readonly state: TState;
581
+ readonly config: TConfig;
582
+ readonly additionalBetAmount?: Big$1;
583
+ };
584
+ export type RandomValuePoolEvent = Readonly<{
585
+ randomValuePool: RandomValuePool;
586
+ }>;
587
+ export type UntypedGameContext = GameContext<{
588
+ readonly type: string;
589
+ }, BaseGameState, unknown>;
590
+ export type PlayResult = UntypedGameContext & {
591
+ readonly proof: Proof;
592
+ };
593
+ export interface GameStore<TInternalState extends BaseGameState, TAction, TConfig> {
594
+ send(event: {
595
+ readonly type: string;
596
+ } & RandomValuePoolEvent & Record<string, unknown>): void;
597
+ getSnapshot(): {
598
+ readonly context: GameContext<TAction, TInternalState, TConfig>;
599
+ };
600
+ }
601
+ export declare abstract class MultiActionGame<TInternalState extends BaseGameState, TExternalState extends BaseGameState, TAction extends {
602
+ readonly type: string;
603
+ }, TConfig> implements Game {
604
+ readonly gameId: OrigamiGame;
605
+ readonly edge: number;
606
+ protected constructor(gameId: OrigamiGame, edge: number);
607
+ abstract get supportedEdgeConfigurations(): [number, ...number[]];
608
+ abstract getValidNextActionTypes(state: TExternalState): ReadonlyArray<TAction['type']>;
609
+ protected abstract createGameStore(): GameStore<TInternalState, TAction, TConfig>;
610
+ protected abstract generateRandomValues(generator: RandomNumberGenerator): RandomValuePool;
611
+ protected abstract toExternalState(internal: TInternalState): TExternalState;
612
+ play(generator: RandomNumberGenerator, action: {
613
+ readonly type: string;
614
+ } & Record<string, unknown>, previousActions?: readonly UntypedGameContext[]): PlayResult;
615
+ private validateEdge;
616
+ }
617
+ //#endregion
618
+ //#region src/games/blackjack/insurance-stake.d.ts
619
+ export type RoundInsuranceStake = (unroundedStake: Big$1) => Big$1;
620
+ export declare const calculateInsuranceStake: (mainBetAmount: Big$1, roundInsuranceStake: RoundInsuranceStake) => Big$1;
621
+ //#endregion
622
+ //#region src/games/blackjack/blackjack.d.ts
623
+ type BlackjackStartAction = Readonly<{
624
+ type: BlackjackActionType.START;
625
+ mainBetAmount: string;
626
+ pairBonusAmount: string;
627
+ threeCardBonusAmount: string;
628
+ }>;
629
+ type BlackjackHitAction = Readonly<{
630
+ type: BlackjackActionType.HIT;
631
+ }>;
632
+ type BlackjackStandAction = Readonly<{
633
+ type: BlackjackActionType.STAND;
634
+ }>;
635
+ type BlackjackBuyInsuranceAction = Readonly<{
636
+ type: BlackjackActionType.BUY_INSURANCE;
637
+ }>;
638
+ type BlackjackRejectInsuranceAction = Readonly<{
639
+ type: BlackjackActionType.REJECT_INSURANCE;
640
+ }>;
641
+ type BlackjackDoubleDownAction = Readonly<{
642
+ type: BlackjackActionType.DOUBLE_DOWN;
643
+ }>;
644
+ type BlackjackSplitAction = Readonly<{
645
+ type: BlackjackActionType.SPLIT;
646
+ }>;
647
+ type BlackjackAction = BlackjackStartAction | BlackjackHitAction | BlackjackStandAction | BlackjackBuyInsuranceAction | BlackjackRejectInsuranceAction | BlackjackDoubleDownAction | BlackjackSplitAction;
648
+ type BlackjackSingleHandStateBase = Readonly<{
649
+ playerHand: BlackjackHandDto;
650
+ dealerHand: BlackjackHandDto;
651
+ sideBetResults: SideBetResults;
652
+ }>;
653
+ type BlackjackAwaitingInsuranceState = Simplify<BlackjackSingleHandStateBase & BaseInProgressState & {
654
+ phase: 'awaiting-insurance';
655
+ }>;
656
+ type BlackjackPlayerTurnState = Simplify<BlackjackSingleHandStateBase & BaseInProgressState & {
657
+ phase: 'player-turn';
658
+ }>;
659
+ type BlackjackSplitHandStateBase = Readonly<{
660
+ mainHand: BlackjackHandDto;
661
+ splitHand: BlackjackHandDto;
662
+ dealerHand: BlackjackHandDto;
663
+ sideBetResults: SideBetResults;
664
+ }>;
665
+ type BlackjackPlayingMainHandState = Simplify<BlackjackSplitHandStateBase & BaseInProgressState & {
666
+ phase: 'playing-main-hand';
667
+ }>;
668
+ type BlackjackPlayingSplitHandState = Simplify<BlackjackSplitHandStateBase & BaseInProgressState & {
669
+ phase: 'playing-split-hand';
670
+ }>;
671
+ type BlackjackFinishedState = Simplify<BlackjackSingleHandStateBase & BaseFinishedState & {
672
+ outcome: BlackjackOutcome;
673
+ insuranceOutcome?: InsuranceOutcome;
674
+ }>;
675
+ type BlackjackSplitFinishedState = Simplify<BlackjackSplitHandStateBase & BaseFinishedState & {
676
+ mainOutcome: BlackjackOutcome;
677
+ splitOutcome: BlackjackOutcome;
678
+ insuranceOutcome?: InsuranceOutcome;
679
+ }>;
680
+ export type BlackjackState = BlackjackAwaitingInsuranceState | BlackjackPlayerTurnState | BlackjackPlayingMainHandState | BlackjackPlayingSplitHandState | BlackjackFinishedState | BlackjackSplitFinishedState;
681
+ type BlackjackConfig = Record<string, never>;
682
+ type BlackjackInternalUninitialisedState = BaseInProgressState & {
683
+ readonly phase: 'uninitialised';
684
+ };
685
+ type BlackjackInternalAwaitingInsuranceState = BaseInProgressState & {
686
+ readonly phase: 'awaiting-insurance';
687
+ readonly playerHand: PlayerHand;
688
+ readonly dealerHand: DealerHand;
689
+ readonly betAmounts: BetAmounts;
690
+ readonly sideBetResults: SideBetResults;
691
+ };
692
+ type BlackjackInternalInProgressState = BaseInProgressState & {
693
+ readonly phase: 'in-progress';
694
+ readonly playerHand: PlayerHand;
695
+ readonly dealerHand: DealerHand;
696
+ readonly insuranceOutcome: InsuranceOutcome | undefined;
697
+ readonly betAmounts: BetAmounts;
698
+ readonly sideBetResults: SideBetResults;
699
+ };
700
+ type BlackjackInternalPlayingMainHandState = BaseInProgressState & {
701
+ readonly phase: 'playing-main-hand';
702
+ readonly mainHand: PlayerHand;
703
+ readonly splitHand: PlayerHand;
704
+ readonly dealerHand: DealerHand;
705
+ readonly insuranceOutcome: InsuranceOutcome | undefined;
706
+ readonly mainHandDoubledDown: boolean;
707
+ readonly betAmounts: BetAmounts;
708
+ readonly sideBetResults: SideBetResults;
709
+ };
710
+ type BlackjackInternalPlayingSplitHandState = BaseInProgressState & {
711
+ readonly phase: 'playing-split-hand';
712
+ readonly mainHand: PlayerHand;
713
+ readonly splitHand: PlayerHand;
714
+ readonly dealerHand: DealerHand;
715
+ readonly insuranceOutcome: InsuranceOutcome | undefined;
716
+ readonly mainHandDoubledDown: boolean;
717
+ readonly splitHandDoubledDown: boolean;
718
+ readonly betAmounts: BetAmounts;
719
+ readonly sideBetResults: SideBetResults;
720
+ };
721
+ type BlackjackInternalFinishedState = BaseFinishedState & {
722
+ readonly phase: 'finished';
723
+ readonly playerHand: PlayerHand;
724
+ readonly dealerHand: DealerHand;
725
+ readonly outcome: BlackjackOutcome;
726
+ readonly insuranceOutcome?: InsuranceOutcome;
727
+ readonly sideBetResults: SideBetResults;
728
+ };
729
+ type BlackjackInternalSplitFinishedState = BaseFinishedState & {
730
+ readonly phase: 'split-finished';
731
+ readonly mainHand: PlayerHand;
732
+ readonly splitHand: PlayerHand;
733
+ readonly dealerHand: DealerHand;
734
+ readonly mainOutcome: BlackjackOutcome;
735
+ readonly splitOutcome: BlackjackOutcome;
736
+ readonly insuranceOutcome?: InsuranceOutcome;
737
+ readonly sideBetResults: SideBetResults;
738
+ };
739
+ type BlackjackInternalState = BlackjackInternalUninitialisedState | BlackjackInternalAwaitingInsuranceState | BlackjackInternalInProgressState | BlackjackInternalPlayingMainHandState | BlackjackInternalPlayingSplitHandState | BlackjackInternalFinishedState | BlackjackInternalSplitFinishedState;
740
+ export type BlackjackGameContext = GameContext<BlackjackAction, BlackjackState, BlackjackConfig>;
741
+ export declare class Blackjack extends MultiActionGame<BlackjackInternalState, BlackjackState, BlackjackAction, BlackjackConfig> {
742
+ private readonly roundInsuranceStake;
743
+ constructor(edge: number, roundInsuranceStake: RoundInsuranceStake);
744
+ get supportedEdgeConfigurations(): [number, ...number[]];
745
+ protected generateRandomValues(generator: RandomNumberGenerator): RandomValuePool;
746
+ protected toExternalState(internal: BlackjackInternalState): BlackjackState;
747
+ protected createGameStore(): GameStore<BlackjackInternalState, BlackjackAction, BlackjackConfig>;
748
+ getValidNextActionTypes(state: BlackjackState): readonly BlackjackActionType[];
749
+ }
750
+ //#endregion
751
+ //#region src/games/blitz/blitz.d.ts
752
+ export interface BlitzGameInputs {
753
+ pickCount: number;
754
+ betAmount: Big$1;
755
+ }
756
+ export interface BlitzGameOutputs {
757
+ cards: CardDto[];
758
+ result: number[];
759
+ }
760
+ export declare const getBlitzDefaults: () => {
761
+ minPicks: number;
762
+ maxPicks: number;
763
+ };
764
+ export declare const hasBlitzWon: (drawnCards: number[]) => boolean;
765
+ /** Returns the probability of winning a Blitz game with a given number of picks between 0-1 */
766
+ export declare const calculateBlitzWinChance: (picks: number) => Big$1;
767
+ export declare class Blitz extends SingleActionGame<BlitzGameInputs, BlitzGameOutputs> {
768
+ constructor();
769
+ get supportedEdgeConfigurations(): [number, ...number[]];
770
+ getBetAmount(gameInputs: BlitzGameInputs): Big$1;
771
+ protected determineGameResult({ generator, gameInputs, edge }: GetGameResultRequest<BlitzGameInputs>): GameResult<BlitzGameOutputs>;
772
+ }
773
+ //#endregion
774
+ //#region src/games/blitz/blitz.constants.d.ts
775
+ export declare const BLITZ_MIN_CARD_RANGE = 0;
776
+ export declare const BLITZ_MAX_CARD_RANGE = 51;
777
+ export declare const BLITZ_CARD_COUNT = 52;
778
+ export declare const BLITZ_RANDOM_NUMBER_COUNT = 52;
779
+ //#endregion
780
+ //#region src/games/darts/darts.constants.d.ts
781
+ export declare const DARTS_MIN_VALUE = 0;
782
+ export declare const DARTS_MAX_VALUE = 4294967295;
783
+ export declare enum DARTS_DIFFICULTY_LEVEL {
784
+ EASY = "EASY",
785
+ MEDIUM = "MEDIUM",
786
+ HARD = "HARD",
787
+ EXPERT = "EXPERT"
788
+ }
789
+ //#endregion
790
+ //#region src/games/darts/darts.d.ts
791
+ export interface DartsGameInputs {
792
+ difficultyLevel: DARTS_DIFFICULTY_LEVEL;
793
+ betAmount: Big$1;
794
+ }
795
+ export declare class Darts extends SingleActionGame<DartsGameInputs> {
796
+ constructor();
797
+ get supportedEdgeConfigurations(): [number, ...number[]];
798
+ getBetAmount(gameInputs: DartsGameInputs): Big$1;
799
+ protected determineGameResult({ generator, gameInputs }: GetGameResultRequest<DartsGameInputs>): GameResult;
800
+ }
801
+ //#endregion
802
+ //#region src/games/darts/darts-difficulty-config.d.ts
803
+ export type Segment = 'YELLOW' | 'ORANGE' | 'RED';
804
+ export type DartboardConfig = ReadonlyDeep<{
805
+ distanceBoundaries: {
806
+ bullseye: number;
807
+ ringOne: number;
808
+ ringTwo: number;
809
+ ringThree: number;
810
+ };
811
+ multipliers: {
812
+ bullseye: number;
813
+ ringOne: number;
814
+ ringTwo: number;
815
+ ringThree: Readonly<Record<Segment, number>>;
816
+ ringFour: number;
817
+ };
818
+ segments: ReadonlyArray<Segment>;
819
+ }>;
820
+ export declare const getMaxMultiplierForDifficulty: (difficultyLevel: DARTS_DIFFICULTY_LEVEL) => number;
821
+ export declare const DARTS_BOARD_CONFIGS: Record<DARTS_DIFFICULTY_LEVEL, DartboardConfig>;
822
+ //#endregion
823
+ //#region src/games/infrastructure/multiplier.container.d.ts
824
+ declare class MultiplierContainer<TMultipliers> {
825
+ readonly multipliers: Map<number, TMultipliers>;
826
+ constructor(multipliers: Map<number, TMultipliers>);
827
+ getMultipliers(edge: number): TMultipliers;
828
+ getAllMultipliers(): {
829
+ edge: number;
830
+ multipliers: TMultipliers;
831
+ }[];
832
+ }
833
+ //#endregion
834
+ //#region src/games/diamonds/diamonds.d.ts
835
+ export interface DiamondsGameInputs {
836
+ betAmount: Big$1;
837
+ }
838
+ export declare enum DiamondsResultType {
839
+ PAIR = "PAIR",
840
+ TWO_PAIR = "TWO_PAIR",
841
+ THREE_OF_A_KIND = "THREE_OF_A_KIND",
842
+ FULL_HOUSE = "FULL_HOUSE",
843
+ FOUR_OF_A_KIND = "FOUR_OF_A_KIND",
844
+ FIVE_OF_A_KIND = "FIVE_OF_A_KIND"
845
+ }
846
+ export type DiamondsMultipliers = Record<keyof typeof DiamondsResultType, number>;
847
+ export declare const diamondsMultipliers: MultiplierContainer<DiamondsMultipliers>;
848
+ export declare class Diamonds extends SingleActionGame<DiamondsGameInputs> {
849
+ constructor();
850
+ get supportedEdgeConfigurations(): [number, ...number[]];
851
+ getBetAmount(gameInputs: DiamondsGameInputs): Big$1;
852
+ protected determineGameResult({ generator, edge, gameInputs }: GetGameResultRequest<DiamondsGameInputs>): GameResult;
853
+ private calculatePayoutMultiplier;
854
+ private classifyResult;
855
+ }
856
+ //#endregion
857
+ //#region src/games/dice/dice.d.ts
858
+ export declare enum DiceDirection {
859
+ ABOVE = "ABOVE",
860
+ BELOW = "BELOW"
861
+ }
862
+ export interface DiceGameInputs {
863
+ direction: DiceDirection;
864
+ selectedValue: number;
865
+ betAmount: Big$1;
866
+ }
867
+ export type DiceSelection = Pick<DiceGameInputs, 'direction' | 'selectedValue'>;
868
+ export declare const DICE_MIN_ROLL = 0;
869
+ export declare const DICE_MAX_ROLL = 10000;
870
+ export declare const DICE_EFFECTIVE_RANGE: number;
871
+ export declare const calculateDiceWinChance: (gameInputs: DiceSelection) => Big$1;
872
+ export declare const hasDiceWon: (gameInputs: DiceSelection, rolledValue: number) => boolean;
873
+ export declare class Dice extends SingleActionGame<DiceGameInputs> {
874
+ constructor();
875
+ get supportedEdgeConfigurations(): [number, ...number[]];
876
+ getBetAmount(gameInputs: DiceGameInputs): Big$1;
877
+ protected determineGameResult({ generator, edge, gameInputs }: GetGameResultRequest<DiceGameInputs>): GameResult;
878
+ }
879
+ //#endregion
880
+ //#region src/games/keno/keno.constants.d.ts
881
+ export declare enum KenoRiskLevel {
882
+ CLASSIC = "CLASSIC",
883
+ LOW_RISK = "LOW_RISK",
884
+ MEDIUM_RISK = "MEDIUM_RISK",
885
+ HIGH_RISK = "HIGH_RISK"
886
+ }
887
+ export declare const TILE_COUNTS: readonly [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
888
+ export type TileCount = (typeof TILE_COUNTS)[number];
889
+ export declare const isTileCount: (value: number) => value is TileCount;
890
+ //#endregion
891
+ //#region src/games/keno/keno.d.ts
892
+ export interface KenoGameInputs {
893
+ riskLevel: KenoRiskLevel;
894
+ selectedNumbers: number[];
895
+ betAmount: Big$1;
896
+ }
897
+ export declare class Keno extends SingleActionGame<KenoGameInputs> {
898
+ constructor();
899
+ get supportedEdgeConfigurations(): [number, ...number[]];
900
+ getBetAmount(gameInputs: KenoGameInputs): Big$1;
901
+ protected determineGameResult({ generator, edge, gameInputs }: GetGameResultRequest<KenoGameInputs>): GameResult;
902
+ }
903
+ //#endregion
904
+ //#region src/games/keno/keno.multipliers.d.ts
905
+ export type KenoMultipliers = Record<TileCount, Record<KenoRiskLevel, number[]>>;
906
+ export declare const rtp99Multipliers: KenoMultipliers;
907
+ export declare const rtp98Multipliers: KenoMultipliers;
908
+ export declare const rtp97Multipliers: KenoMultipliers;
909
+ export declare const rtp96Multipliers: KenoMultipliers;
910
+ export declare const rtp92Multipliers: KenoMultipliers;
911
+ export declare const kenoMultipliers: MultiplierContainer<KenoMultipliers>;
912
+ //#endregion
913
+ //#region src/games/limbo/limbo.d.ts
914
+ export interface LimboGameInputs {
915
+ targetMultiplier: number;
916
+ betAmount: Big$1;
917
+ }
918
+ export interface LimboGameOutputs {
919
+ randomMultiplier: Big$1;
920
+ }
921
+ export declare class Limbo extends SingleActionGame<LimboGameInputs, LimboGameOutputs> {
922
+ constructor();
923
+ get supportedEdgeConfigurations(): [number, ...number[]];
924
+ getBetAmount(gameInputs: LimboGameInputs): Big$1;
925
+ protected determineGameResult({ generator, edge, gameInputs }: GetGameResultRequest<LimboGameInputs>): GameResult<LimboGameOutputs>;
926
+ }
927
+ //#endregion
928
+ //#region src/games/mines/mines.d.ts
929
+ export interface MinesGameInputs {
930
+ minesCount: number;
931
+ selectedTiles: number[];
932
+ hasCashedOut: boolean;
933
+ betAmount: Big$1;
934
+ }
935
+ export declare class Mines extends SingleActionGame<MinesGameInputs> {
936
+ constructor();
937
+ get supportedEdgeConfigurations(): [number, ...number[]];
938
+ getBetAmount(gameInputs: MinesGameInputs): Big$1;
939
+ protected determineGameResult({ generator, edge, gameInputs }: GetGameResultRequest<MinesGameInputs>): GameResult;
940
+ }
941
+ //#endregion
942
+ //#region src/games/plinko/plinko.constants.d.ts
943
+ export declare enum PlinkoRiskLevel {
944
+ LOW_RISK = "LOW_RISK",
945
+ MEDIUM_RISK = "MEDIUM_RISK",
946
+ HIGH_RISK = "HIGH_RISK"
947
+ }
948
+ //#endregion
949
+ //#region src/games/plinko/plinko.d.ts
950
+ export interface PlinkoGameInputs {
951
+ numberOfRows: number;
952
+ riskLevel: PlinkoRiskLevel;
953
+ betAmount: Big;
954
+ }
955
+ export declare class Plinko extends SingleActionGame<PlinkoGameInputs> {
956
+ constructor();
957
+ get supportedEdgeConfigurations(): [number, ...number[]];
958
+ getBetAmount(gameInputs: PlinkoGameInputs): Big;
959
+ protected determineGameResult({ generator, gameInputs, edge }: GetGameResultRequest<PlinkoGameInputs>): GameResult;
960
+ }
961
+ //#endregion
962
+ //#region src/games/plinko/plinko.multipliers.d.ts
963
+ export declare const PLINKO_ROW_COUNTS: readonly [8, 9, 10, 11, 12, 13, 14, 15, 16];
964
+ export type PlinkoRowCount = (typeof PLINKO_ROW_COUNTS)[number];
965
+ export type PlinkoMultiplierSet = Record<PlinkoRowCount, number[]>;
966
+ export type PlinkoMultipliers = Record<PlinkoRiskLevel, PlinkoMultiplierSet>;
967
+ export declare const plinkoMultipliers: MultiplierContainer<PlinkoMultipliers>;
968
+ //#endregion
969
+ //#region src/games/roulette/roulette.types.d.ts
970
+ export declare const VALID_EUROPEAN_STRAIGHTS: readonly [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36];
971
+ export type EuropeanStraight = (typeof VALID_EUROPEAN_STRAIGHTS)[number];
972
+ export declare const VALID_AMERICAN_STRAIGHTS: readonly [37, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36];
973
+ export type AmericanStraight = (typeof VALID_AMERICAN_STRAIGHTS)[number];
974
+ export interface EuropeanStraightBet extends BaseBet {
975
+ value: EuropeanStraight;
976
+ }
977
+ export interface AmericanStraightBet extends BaseBet {
978
+ value: AmericanStraight;
979
+ }
980
+ export declare const VALID_EUROPEAN_SPLITS: readonly [readonly [0, 1], readonly [0, 2], readonly [0, 3], readonly [1, 2], readonly [1, 4], readonly [2, 3], readonly [2, 5], readonly [3, 6], readonly [4, 5], readonly [4, 7], readonly [5, 6], readonly [5, 8], readonly [6, 9], readonly [7, 8], readonly [7, 10], readonly [8, 9], readonly [8, 11], readonly [9, 12], readonly [10, 11], readonly [10, 13], readonly [11, 12], readonly [11, 14], readonly [12, 15], readonly [13, 14], readonly [13, 16], readonly [14, 15], readonly [14, 17], readonly [15, 18], readonly [16, 17], readonly [16, 19], readonly [17, 18], readonly [17, 20], readonly [18, 21], readonly [19, 20], readonly [19, 22], readonly [20, 21], readonly [20, 23], readonly [21, 24], readonly [22, 23], readonly [22, 25], readonly [23, 24], readonly [23, 26], readonly [24, 27], readonly [25, 26], readonly [25, 28], readonly [26, 27], readonly [26, 29], readonly [27, 30], readonly [28, 29], readonly [28, 31], readonly [29, 30], readonly [29, 32], readonly [30, 33], readonly [31, 32], readonly [31, 34], readonly [32, 33], readonly [32, 35], readonly [33, 36], readonly [34, 35], readonly [35, 36]];
981
+ export type EuropeanSplit = (typeof VALID_EUROPEAN_SPLITS)[number];
982
+ export interface EuropeanSplitBet extends BaseBet {
983
+ values: EuropeanSplit;
984
+ }
985
+ export declare const VALID_AMERICAN_SPLITS: readonly [readonly [0, 1], readonly [0, 37], readonly [3, 37], readonly [1, 2], readonly [1, 4], readonly [2, 3], readonly [2, 5], readonly [3, 6], readonly [4, 5], readonly [4, 7], readonly [5, 6], readonly [5, 8], readonly [6, 9], readonly [7, 8], readonly [7, 10], readonly [8, 9], readonly [8, 11], readonly [9, 12], readonly [10, 11], readonly [10, 13], readonly [11, 12], readonly [11, 14], readonly [12, 15], readonly [13, 14], readonly [13, 16], readonly [14, 15], readonly [14, 17], readonly [15, 18], readonly [16, 17], readonly [16, 19], readonly [17, 18], readonly [17, 20], readonly [18, 21], readonly [19, 20], readonly [19, 22], readonly [20, 21], readonly [20, 23], readonly [21, 24], readonly [22, 23], readonly [22, 25], readonly [23, 24], readonly [23, 26], readonly [24, 27], readonly [25, 26], readonly [25, 28], readonly [26, 27], readonly [26, 29], readonly [27, 30], readonly [28, 29], readonly [28, 31], readonly [29, 30], readonly [29, 32], readonly [30, 33], readonly [31, 32], readonly [31, 34], readonly [32, 33], readonly [32, 35], readonly [33, 36], readonly [34, 35], readonly [35, 36]];
986
+ export type AmericanSplit = (typeof VALID_AMERICAN_SPLITS)[number];
987
+ export interface AmericanSplitBet extends BaseBet {
988
+ values: AmericanSplit;
989
+ }
990
+ export declare const VALID_EUROPEAN_STREETS: readonly [readonly [0, 1, 2], readonly [0, 2, 3], readonly [1, 2, 3], readonly [4, 5, 6], readonly [7, 8, 9], readonly [10, 11, 12], readonly [13, 14, 15], readonly [16, 17, 18], readonly [19, 20, 21], readonly [22, 23, 24], readonly [25, 26, 27], readonly [28, 29, 30], readonly [31, 32, 33], readonly [34, 35, 36]];
991
+ export type EuropeanStreet = (typeof VALID_EUROPEAN_STREETS)[number];
992
+ export interface BaseBet {
993
+ amount: Big;
994
+ }
995
+ export interface EuropeanStreetBet extends BaseBet {
996
+ values: EuropeanStreet;
997
+ }
998
+ export declare const VALID_AMERICAN_STREETS: readonly [readonly [0, 1, 2], readonly [0, 2, 37], readonly [1, 2, 3], readonly [2, 3, 37], readonly [4, 5, 6], readonly [7, 8, 9], readonly [10, 11, 12], readonly [13, 14, 15], readonly [16, 17, 18], readonly [19, 20, 21], readonly [22, 23, 24], readonly [25, 26, 27], readonly [28, 29, 30], readonly [31, 32, 33], readonly [34, 35, 36]];
999
+ export type AmericanStreet = (typeof VALID_AMERICAN_STREETS)[number];
1000
+ export interface AmericanStreetBet extends BaseBet {
1001
+ values: AmericanStreet;
1002
+ }
1003
+ export declare const VALID_EUROPEAN_CORNERS: readonly [readonly [0, 1, 2, 3], readonly [1, 2, 4, 5], readonly [2, 3, 5, 6], readonly [4, 5, 7, 8], readonly [5, 6, 8, 9], readonly [7, 8, 10, 11], readonly [8, 9, 11, 12], readonly [10, 11, 13, 14], readonly [11, 12, 14, 15], readonly [13, 14, 16, 17], readonly [14, 15, 17, 18], readonly [16, 17, 19, 20], readonly [17, 18, 20, 21], readonly [19, 20, 22, 23], readonly [20, 21, 23, 24], readonly [22, 23, 25, 26], readonly [23, 24, 26, 27], readonly [25, 26, 28, 29], readonly [26, 27, 29, 30], readonly [28, 29, 31, 32], readonly [29, 30, 32, 33], readonly [31, 32, 34, 35], readonly [32, 33, 35, 36]];
1004
+ export type EuropeanCorner = (typeof VALID_EUROPEAN_CORNERS)[number];
1005
+ export interface EuropeanCornerBet extends BaseBet {
1006
+ values: EuropeanCorner;
1007
+ }
1008
+ export declare const VALID_AMERICAN_CORNERS: readonly [readonly [1, 2, 4, 5], readonly [2, 3, 5, 6], readonly [4, 5, 7, 8], readonly [5, 6, 8, 9], readonly [7, 8, 10, 11], readonly [8, 9, 11, 12], readonly [10, 11, 13, 14], readonly [11, 12, 14, 15], readonly [13, 14, 16, 17], readonly [14, 15, 17, 18], readonly [16, 17, 19, 20], readonly [17, 18, 20, 21], readonly [19, 20, 22, 23], readonly [20, 21, 23, 24], readonly [22, 23, 25, 26], readonly [23, 24, 26, 27], readonly [25, 26, 28, 29], readonly [26, 27, 29, 30], readonly [28, 29, 31, 32], readonly [29, 30, 32, 33], readonly [31, 32, 34, 35], readonly [32, 33, 35, 36]];
1009
+ export type AmericanCorner = (typeof VALID_AMERICAN_CORNERS)[number];
1010
+ export interface AmericanCornerBet extends BaseBet {
1011
+ values: AmericanCorner;
1012
+ }
1013
+ export declare const AMERICAN_BASKET: readonly [0, 1, 2, 3, 37];
1014
+ export interface AmericanBasketBet extends BaseBet {}
1015
+ export declare const VALID_EUROPEAN_DOUBLE_STREETS: readonly [readonly [1, 2, 3, 4, 5, 6], readonly [4, 5, 6, 7, 8, 9], readonly [7, 8, 9, 10, 11, 12], readonly [10, 11, 12, 13, 14, 15], readonly [13, 14, 15, 16, 17, 18], readonly [16, 17, 18, 19, 20, 21], readonly [19, 20, 21, 22, 23, 24], readonly [22, 23, 24, 25, 26, 27], readonly [25, 26, 27, 28, 29, 30], readonly [28, 29, 30, 31, 32, 33], readonly [31, 32, 33, 34, 35, 36]];
1016
+ export type EuropeanDoubleStreet = (typeof VALID_EUROPEAN_DOUBLE_STREETS)[number];
1017
+ export interface EuropeanDoubleStreetBet extends BaseBet {
1018
+ values: EuropeanDoubleStreet;
1019
+ }
1020
+ export declare const VALID_AMERICAN_DOUBLE_STREETS: readonly [readonly [1, 2, 3, 4, 5, 6], readonly [4, 5, 6, 7, 8, 9], readonly [7, 8, 9, 10, 11, 12], readonly [10, 11, 12, 13, 14, 15], readonly [13, 14, 15, 16, 17, 18], readonly [16, 17, 18, 19, 20, 21], readonly [19, 20, 21, 22, 23, 24], readonly [22, 23, 24, 25, 26, 27], readonly [25, 26, 27, 28, 29, 30], readonly [28, 29, 30, 31, 32, 33], readonly [31, 32, 33, 34, 35, 36]];
1021
+ export type AmericanDoubleStreet = (typeof VALID_AMERICAN_DOUBLE_STREETS)[number];
1022
+ export interface AmericanDoubleStreetBet extends BaseBet {
1023
+ values: AmericanDoubleStreet;
1024
+ }
1025
+ export declare enum Parity {
1026
+ EVEN = "EVEN",
1027
+ ODD = "ODD"
1028
+ }
1029
+ export interface ParityBet extends BaseBet {
1030
+ parity: Parity;
1031
+ }
1032
+ export declare enum Color {
1033
+ RED = "RED",
1034
+ BLACK = "BLACK"
1035
+ }
1036
+ export interface ColorBet extends BaseBet {
1037
+ color: Color;
1038
+ }
1039
+ export declare enum Half {
1040
+ LOW = "LOW",
1041
+ HIGH = "HIGH"
1042
+ }
1043
+ export interface HalfBet extends BaseBet {
1044
+ half: Half;
1045
+ }
1046
+ export declare enum Column {
1047
+ TOP = "TOP",
1048
+ MIDDLE = "MIDDLE",
1049
+ BOTTOM = "BOTTOM"
1050
+ }
1051
+ export interface ColumnBet extends BaseBet {
1052
+ column: Column;
1053
+ }
1054
+ export declare enum Dozen {
1055
+ FIRST = "FIRST",
1056
+ SECOND = "SECOND",
1057
+ THIRD = "THIRD"
1058
+ }
1059
+ export interface DozenBet extends BaseBet {
1060
+ dozen: Dozen;
1061
+ }
1062
+ export interface EuropeanRouletteGameInputs {
1063
+ straightBets: EuropeanStraightBet[];
1064
+ splitBets: EuropeanSplitBet[];
1065
+ streetBets: EuropeanStreetBet[];
1066
+ cornerBets: EuropeanCornerBet[];
1067
+ doubleStreetBets: EuropeanDoubleStreetBet[];
1068
+ parityBets: ParityBet[];
1069
+ colorBets: ColorBet[];
1070
+ halfBets: HalfBet[];
1071
+ columnBets: ColumnBet[];
1072
+ dozenBets: DozenBet[];
1073
+ }
1074
+ export interface AmericanRouletteGameInputs {
1075
+ straightBets: AmericanStraightBet[];
1076
+ splitBets: AmericanSplitBet[];
1077
+ streetBets: AmericanStreetBet[];
1078
+ cornerBets: AmericanCornerBet[];
1079
+ basketBets: AmericanBasketBet[];
1080
+ doubleStreetBets: AmericanDoubleStreetBet[];
1081
+ parityBets: ParityBet[];
1082
+ colorBets: ColorBet[];
1083
+ halfBets: HalfBet[];
1084
+ columnBets: ColumnBet[];
1085
+ dozenBets: DozenBet[];
1086
+ }
1087
+ export declare enum RouletteType {
1088
+ AMERICAN = "AMERICAN",
1089
+ EUROPEAN = "EUROPEAN"
1090
+ }
1091
+ export declare const EUROPEAN_HOUSE_EDGE = 2.7;
1092
+ export declare const AMERICAN_HOUSE_EDGE = 5.3;
1093
+ export type RouletteGameInputs = {
1094
+ type: RouletteType.EUROPEAN;
1095
+ inputs: EuropeanRouletteGameInputs;
1096
+ } | {
1097
+ type: RouletteType.AMERICAN;
1098
+ inputs: AmericanRouletteGameInputs;
1099
+ };
1100
+ export interface EuropeanRouletteBetOutcomes {
1101
+ winningBets: EuropeanRouletteGameInputs;
1102
+ losingBets: EuropeanRouletteGameInputs;
1103
+ }
1104
+ export interface AmericanRouletteBetOutcomes {
1105
+ winningBets: AmericanRouletteGameInputs;
1106
+ losingBets: AmericanRouletteGameInputs;
1107
+ }
1108
+ export interface EuropeanRouletteGameOutputs {
1109
+ betOutcomes: EuropeanRouletteBetOutcomes;
1110
+ result: number[];
1111
+ }
1112
+ export interface AmericanRouletteGameOutputs {
1113
+ betOutcomes: AmericanRouletteBetOutcomes;
1114
+ result: number[];
1115
+ }
1116
+ export type RouletteGameOutputs = {
1117
+ type: 'european';
1118
+ betOutcomes: EuropeanRouletteBetOutcomes;
1119
+ result: number[];
1120
+ } | {
1121
+ type: 'american';
1122
+ betOutcomes: AmericanRouletteBetOutcomes;
1123
+ result: number[];
1124
+ };
1125
+ //#endregion
1126
+ //#region src/games/roulette/roulette.d.ts
1127
+ export declare const PAYOUT_MULTIPLIERS: Record<keyof EuropeanRouletteGameInputs | keyof AmericanRouletteGameInputs, number>;
1128
+ export declare const TOP_COLUMN: number[];
1129
+ export declare const MIDDLE_COLUMN: number[];
1130
+ export declare const BOTTOM_COLUMN: number[];
1131
+ export declare const RED_NUMBERS: number[];
1132
+ export declare const BLACK_NUMBERS: number[];
1133
+ type BetPredicate = (bet: BaseBet, result: number) => boolean;
1134
+ declare abstract class BaseRoulette<TInputs extends {
1135
+ straightBets: BaseBet[];
1136
+ splitBets: BaseBet[];
1137
+ streetBets: BaseBet[];
1138
+ cornerBets: BaseBet[];
1139
+ doubleStreetBets: BaseBet[];
1140
+ parityBets: BaseBet[];
1141
+ colorBets: BaseBet[];
1142
+ halfBets: BaseBet[];
1143
+ columnBets: BaseBet[];
1144
+ dozenBets: BaseBet[];
1145
+ }, TOutputs extends {
1146
+ betOutcomes: {
1147
+ winningBets: TInputs;
1148
+ losingBets: TInputs;
1149
+ };
1150
+ result: number[];
1151
+ }> extends SingleActionGame<TInputs, TOutputs> {
1152
+ protected abstract readonly maxNumber: number;
1153
+ constructor();
1154
+ determineGameResult({ generator, gameInputs }: GetGameResultRequest<TInputs>): GameResult<TOutputs>;
1155
+ getBetAmount(gameInputs: TInputs): Big;
1156
+ getPayoutDetails(gameInputs: TInputs, gameResult: number): {
1157
+ payoutMultiplier: Big;
1158
+ payout: Payout;
1159
+ };
1160
+ protected determineBetOutcomes(inputs: TInputs, result: number): {
1161
+ winningBets: TInputs;
1162
+ losingBets: TInputs;
1163
+ };
1164
+ protected calculateTotalAmount(bets: {
1165
+ amount: Big;
1166
+ }[]): Big;
1167
+ protected isWinningStraightBet(bet: BaseBet, gameResult: number): boolean;
1168
+ protected isWinningSplitBet(bet: BaseBet, gameResult: number): boolean;
1169
+ protected isWinningStreetBet(bet: BaseBet, gameResult: number): boolean;
1170
+ protected isWinningCornerBet(bet: BaseBet, gameResult: number): boolean;
1171
+ protected isWinningDoubleStreetBet(bet: BaseBet, gameResult: number): boolean;
1172
+ protected isWinningColorBet(bet: BaseBet, gameResult: number): boolean;
1173
+ protected isWinningHalfBet(bet: BaseBet, gameResult: number): boolean;
1174
+ protected isWinningColumnBet(bet: BaseBet, gameResult: number): boolean;
1175
+ protected isWinningDozenBet(bet: BaseBet, gameResult: number): boolean;
1176
+ protected isWinningParityBet(bet: BaseBet, gameResult: number): boolean;
1177
+ protected getBetTotals(inputs: TInputs): Record<keyof TInputs, Big>;
1178
+ protected calculateTotalBetAmount(totals: Record<keyof TInputs, Big>): Big;
1179
+ protected abstract validateInputs(inputs: TInputs): void;
1180
+ protected abstract readonly betPredicates: Record<keyof TInputs, BetPredicate>;
1181
+ private partitionBets;
1182
+ /**
1183
+ * One leg per bet actually placed, in the order the inputs list them. A bet type the player
1184
+ * left empty contributes nothing, so an untouched part of the table produces no leg at all.
1185
+ */
1186
+ protected calculatePayoutLegs(inputs: TInputs, result: number): PayoutLeg[];
1187
+ }
1188
+ export declare class EuropeanRoulette extends BaseRoulette<EuropeanRouletteGameInputs, EuropeanRouletteGameOutputs> {
1189
+ protected readonly maxNumber = 36;
1190
+ protected readonly betPredicates: Record<keyof EuropeanRouletteGameInputs, BetPredicate>;
1191
+ get supportedEdgeConfigurations(): [number, ...number[]];
1192
+ protected validateInputs(inputs: EuropeanRouletteGameInputs): void;
1193
+ }
1194
+ export declare class AmericanRoulette extends BaseRoulette<AmericanRouletteGameInputs, AmericanRouletteGameOutputs> {
1195
+ protected readonly maxNumber = 37;
1196
+ protected readonly betPredicates: Record<keyof AmericanRouletteGameInputs, BetPredicate>;
1197
+ get supportedEdgeConfigurations(): [number, ...number[]];
1198
+ protected validateInputs(inputs: AmericanRouletteGameInputs): void;
1199
+ protected isWinningBasketBet(_bet: BaseBet, gameResult: number): boolean;
1200
+ }
1201
+ export declare class Roulette extends SingleActionGame<RouletteGameInputs, RouletteGameOutputs> {
1202
+ private readonly europeanGame;
1203
+ private readonly americanGame;
1204
+ constructor();
1205
+ get supportedEdgeConfigurations(): [number, ...number[]];
1206
+ getBetAmount(gameInputs: RouletteGameInputs): Big;
1207
+ protected determineGameResult(request: GetGameResultRequest<RouletteGameInputs>): GameResult<RouletteGameOutputs>;
1208
+ }
1209
+ export declare const calculateRouletteBetAmount: (gameInputs: RouletteGameInputs) => Big;
1210
+ //#endregion
1211
+ //#region src/games/roulette/roulette.validation.d.ts
1212
+ export declare const validateRouletteGameInputs: (gameInputs: RouletteGameInputs, edge: number) => void;
1213
+ //#endregion
1214
+ //#region src/games/wheel/wheel.constants.d.ts
1215
+ export declare enum WheelRiskLevel {
1216
+ LOW_RISK = "LOW_RISK",
1217
+ MEDIUM_RISK = "MEDIUM_RISK",
1218
+ HIGH_RISK = "HIGH_RISK"
1219
+ }
1220
+ export declare enum WheelSegments {
1221
+ TEN = 10,
1222
+ TWENTY = 20,
1223
+ THIRTY = 30,
1224
+ FORTY = 40,
1225
+ FIFTY = 50
1226
+ }
1227
+ //#endregion
1228
+ //#region src/games/wheel/wheel.d.ts
1229
+ export interface WheelGameInputs {
1230
+ segments: WheelSegments;
1231
+ riskLevel: WheelRiskLevel;
1232
+ betAmount: Big;
1233
+ }
1234
+ export declare class Wheel extends SingleActionGame<WheelGameInputs> {
1235
+ constructor();
1236
+ get supportedEdgeConfigurations(): [number, ...number[]];
1237
+ getBetAmount(gameInputs: WheelGameInputs): Big;
1238
+ protected determineGameResult({ generator, gameInputs, edge }: GetGameResultRequest<WheelGameInputs>): GameResult;
1239
+ }
1240
+ //#endregion
1241
+ //#region src/utils/big-max.d.ts
1242
+ export declare const bigMax: (a: Big$1, b: Big$1) => Big$1;
1243
+ //#endregion
1244
+ //#region src/utils/big-min.d.ts
1245
+ export declare const bigMin: (a: Big$1, b: Big$1) => Big$1;
1246
+ //#endregion
1247
+ //#region src/utils/multiplier-calculator.d.ts
1248
+ export declare abstract class MultiplierCalculator {
1249
+ static withMultiplier(multiplier: Big$1, edge: number): Big$1;
1250
+ static withWinChance(edge: number, winChance: Big$1): Big$1;
1251
+ }
1252
+ //#endregion
1253
+ //#region src/utils/ncr.d.ts
1254
+ export declare const nCr: (n: number, r: number) => number;
1255
+ //#endregion