@betorigami/game-wheel 1.0.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/definition.cjs +1 -0
- package/dist/definition.d.cts +5 -0
- package/dist/definition.d.ts +5 -0
- package/dist/definition.mjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -66
- package/dist/index.d.ts +2 -66
- package/dist/index.mjs +1 -1
- package/dist/wheel-Bz3jdq73.mjs +1 -0
- package/dist/wheel-CGTrssL3.cjs +1 -0
- package/dist/wheel-Cr_6CS0C.d.cts +65 -0
- package/dist/wheel-Cr_6CS0C.d.ts +65 -0
- package/package.json +9 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./wheel-CGTrssL3.cjs");let t=require("@betorigami/game-engine"),n=require("@betorigami/game-engine/storage"),r=require("zod");const i=new e.t,a={id:t.OrigamiGame.WHEEL,edges:i.supportedEdgeConfigurations,engine:i,inputSerializer:r.z.object({riskLevel:r.z.enum(e._),segments:r.z.enum(e.v),betAmount:n.storedBigCodec}),outputSerializer:r.z.object({result:r.z.array(r.z.number())})};exports.wheelDefinition=a;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { n as WheelGameInputs } from "./wheel-Cr_6CS0C.cjs";
|
|
2
|
+
import { OrigamiGame, SingleActionGameDefinition } from "@betorigami/game-engine";
|
|
3
|
+
//#region src/definition.d.ts
|
|
4
|
+
export declare const wheelDefinition: SingleActionGameDefinition<OrigamiGame.WHEEL, WheelGameInputs>;
|
|
5
|
+
//#endregion
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { n as WheelGameInputs } from "./wheel-Cr_6CS0C.js";
|
|
2
|
+
import { OrigamiGame, SingleActionGameDefinition } from "@betorigami/game-engine";
|
|
3
|
+
//#region src/definition.d.ts
|
|
4
|
+
export declare const wheelDefinition: SingleActionGameDefinition<OrigamiGame.WHEEL, WheelGameInputs>;
|
|
5
|
+
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as e,t,v as n}from"./wheel-Bz3jdq73.mjs";import{OrigamiGame as r}from"@betorigami/game-engine";import{storedBigCodec as i}from"@betorigami/game-engine/storage";import{z as a}from"zod";const o=new t,s={id:r.WHEEL,edges:o.supportedEdgeConfigurations,engine:o,inputSerializer:a.object({riskLevel:a.enum(e),segments:a.enum(n),betAmount:i}),outputSerializer:a.object({result:a.array(a.number())})};export{s as wheelDefinition};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./wheel-CGTrssL3.cjs");exports.FIXED_PATTERNS=e.u,exports.WHEEL_RISK_LEVELS=e.p,exports.WHEEL_SEGMENT_OPTIONS=e.m,exports.WHEEL_SELECTIONS=e.h,exports.WHEEL_SLOTS=e.g,exports.Wheel=e.t,exports.WheelRiskLevel=e._,exports.WheelSegments=e.v,exports.calculateWheelRtpFraction=e.n,exports.describeWheelOutcomes=e.r,exports.getFullWheelPattern=e.d,exports.getWheelMaxMultiplier=e.i,exports.getWheelPattern=e.a,exports.getWheelSegmentMultipliers=e.o,exports.getWheelSlotMultiplier=e.s,exports.getWheelSlotValues=e.c,exports.isWheelRiskLevel=e.y,exports.isWheelSegments=e.b,exports.validateWheelSelection=e.l,exports.wheelMultipliers=e.f;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,70 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { DescribesOutcomes, GameDescriptor, GameResult, GetGameResultRequest, MultiplierContainer, Outcome, OutcomeDistribution, SingleActionGame } from "@betorigami/game-engine";
|
|
3
|
-
//#region src/wheel.constants.d.ts
|
|
4
|
-
export declare enum WheelRiskLevel {
|
|
5
|
-
LOW_RISK = "LOW_RISK",
|
|
6
|
-
MEDIUM_RISK = "MEDIUM_RISK",
|
|
7
|
-
HIGH_RISK = "HIGH_RISK"
|
|
8
|
-
}
|
|
9
|
-
export declare enum WheelSegments {
|
|
10
|
-
TEN = 10,
|
|
11
|
-
TWENTY = 20,
|
|
12
|
-
THIRTY = 30,
|
|
13
|
-
FORTY = 40,
|
|
14
|
-
FIFTY = 50
|
|
15
|
-
}
|
|
16
|
-
export declare const WHEEL_SLOTS: readonly ["ZERO", "A", "B", "C", "D", "E"];
|
|
17
|
-
export type WheelSlot = (typeof WHEEL_SLOTS)[number];
|
|
18
|
-
export declare const WHEEL_RISK_LEVELS: readonly WheelRiskLevel[];
|
|
19
|
-
export declare const WHEEL_SEGMENT_OPTIONS: readonly WheelSegments[];
|
|
20
|
-
export type WheelSelection = Readonly<{
|
|
21
|
-
riskLevel: WheelRiskLevel;
|
|
22
|
-
segments: WheelSegments;
|
|
23
|
-
}>;
|
|
24
|
-
export declare const WHEEL_SELECTIONS: readonly WheelSelection[];
|
|
25
|
-
export declare const isWheelRiskLevel: (value: unknown) => value is WheelRiskLevel;
|
|
26
|
-
export declare const isWheelSegments: (value: unknown) => value is WheelSegments;
|
|
27
|
-
//#endregion
|
|
28
|
-
//#region src/wheel.multipliers.d.ts
|
|
29
|
-
type WheelSlotValues = Partial<Record<WheelSlot, number>>;
|
|
30
|
-
export declare const wheelMultipliers: MultiplierContainer<Record<WheelRiskLevel, Record<WheelSegments, Partial<Record<"ZERO" | "A" | "B" | "C" | "D" | "E", number>>>>>;
|
|
31
|
-
//#endregion
|
|
32
|
-
//#region src/wheel.outcomes.d.ts
|
|
33
|
-
export type WheelOutcome = Outcome<WheelSlot>;
|
|
34
|
-
export type WheelOutcomeDistribution = OutcomeDistribution<WheelSlot>;
|
|
35
|
-
export declare const validateWheelSelection: ({ riskLevel, segments }: WheelSelection) => void;
|
|
36
|
-
export declare const getWheelPattern: ({ riskLevel, segments }: WheelSelection) => readonly WheelSlot[];
|
|
37
|
-
export declare const getWheelSlotValues: ({ riskLevel, segments }: WheelSelection, edge: number) => WheelSlotValues;
|
|
38
|
-
export declare const getWheelSlotMultiplier: (slotValues: WheelSlotValues, slot: WheelSlot) => Big$1;
|
|
39
|
-
export declare const getWheelSegmentMultipliers: (selection: WheelSelection, edge: number) => Big$1[];
|
|
40
|
-
export declare const describeWheelOutcomes: (selection: WheelSelection, edge: number) => WheelOutcomeDistribution;
|
|
41
|
-
export declare const getWheelMaxMultiplier: (edge: number, selection?: WheelSelection) => Big$1;
|
|
42
|
-
/**
|
|
43
|
-
* The return to player of a selection as a fraction of the stake, kept exact.
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* calculateWheelRtpFraction(selection, 2); // Big('0.98') for a nominal 2% edge, not 98
|
|
47
|
-
* calculateWheelRtpFraction(selection, 2).times(100).toFixed(2); // '98.00', only at the point of display
|
|
48
|
-
*/
|
|
49
|
-
export declare const calculateWheelRtpFraction: (selection: WheelSelection, edge: number) => Big$1;
|
|
50
|
-
//#endregion
|
|
51
|
-
//#region src/wheel.d.ts
|
|
52
|
-
export interface WheelGameInputs {
|
|
53
|
-
segments: WheelSegments;
|
|
54
|
-
riskLevel: WheelRiskLevel;
|
|
55
|
-
betAmount: Big;
|
|
56
|
-
}
|
|
57
|
-
export declare class Wheel extends SingleActionGame<WheelGameInputs> implements DescribesOutcomes<WheelSelection, WheelSlot> {
|
|
58
|
-
constructor();
|
|
59
|
-
get supportedEdgeConfigurations(): [number, ...number[]];
|
|
60
|
-
getBetAmount(gameInputs: WheelGameInputs): Big;
|
|
61
|
-
describeOutcomes(selection: WheelSelection, edge: number): WheelOutcomeDistribution;
|
|
62
|
-
protected determineGameResult({ generator, gameInputs, edge }: GetGameResultRequest<WheelGameInputs>): GameResult;
|
|
63
|
-
}
|
|
64
|
-
export declare const wheelDescriptor: GameDescriptor<WheelGameInputs>;
|
|
65
|
-
//#endregion
|
|
1
|
+
import { C as isWheelRiskLevel, S as WheelSlot, _ as WHEEL_SELECTIONS, a as calculateWheelRtpFraction, b as WheelSegments, c as getWheelPattern, d as getWheelSlotValues, f as validateWheelSelection, g as WHEEL_SEGMENT_OPTIONS, h as WHEEL_RISK_LEVELS, i as WheelOutcomeDistribution, l as getWheelSegmentMultipliers, m as wheelMultipliers, n as WheelGameInputs, o as describeWheelOutcomes, p as WheelSlotValues, r as WheelOutcome, s as getWheelMaxMultiplier, t as Wheel, u as getWheelSlotMultiplier, v as WHEEL_SLOTS, w as isWheelSegments, x as WheelSelection, y as WheelRiskLevel } from "./wheel-Cr_6CS0C.cjs";
|
|
66
2
|
//#region src/wheel.patterns.d.ts
|
|
67
3
|
export declare const FIXED_PATTERNS: Record<WheelRiskLevel, Record<WheelSegments, readonly WheelSlot[]>>;
|
|
68
4
|
export declare const getFullWheelPattern: (riskLevel: WheelRiskLevel, segment: WheelSegments) => readonly ("ZERO" | "A" | "B" | "C" | "D" | "E")[];
|
|
69
5
|
//#endregion
|
|
70
|
-
export type
|
|
6
|
+
export { WHEEL_RISK_LEVELS, WHEEL_SEGMENT_OPTIONS, WHEEL_SELECTIONS, WHEEL_SLOTS, Wheel, WheelGameInputs, WheelOutcome, WheelOutcomeDistribution, WheelRiskLevel, WheelSegments, WheelSelection, WheelSlot, type WheelSlotValues, calculateWheelRtpFraction, describeWheelOutcomes, getWheelMaxMultiplier, getWheelPattern, getWheelSegmentMultipliers, getWheelSlotMultiplier, getWheelSlotValues, isWheelRiskLevel, isWheelSegments, validateWheelSelection, wheelMultipliers };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,70 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import Big$1, { Big } from "big.js";
|
|
3
|
-
//#region src/wheel.constants.d.ts
|
|
4
|
-
export declare enum WheelRiskLevel {
|
|
5
|
-
LOW_RISK = "LOW_RISK",
|
|
6
|
-
MEDIUM_RISK = "MEDIUM_RISK",
|
|
7
|
-
HIGH_RISK = "HIGH_RISK"
|
|
8
|
-
}
|
|
9
|
-
export declare enum WheelSegments {
|
|
10
|
-
TEN = 10,
|
|
11
|
-
TWENTY = 20,
|
|
12
|
-
THIRTY = 30,
|
|
13
|
-
FORTY = 40,
|
|
14
|
-
FIFTY = 50
|
|
15
|
-
}
|
|
16
|
-
export declare const WHEEL_SLOTS: readonly ["ZERO", "A", "B", "C", "D", "E"];
|
|
17
|
-
export type WheelSlot = (typeof WHEEL_SLOTS)[number];
|
|
18
|
-
export declare const WHEEL_RISK_LEVELS: readonly WheelRiskLevel[];
|
|
19
|
-
export declare const WHEEL_SEGMENT_OPTIONS: readonly WheelSegments[];
|
|
20
|
-
export type WheelSelection = Readonly<{
|
|
21
|
-
riskLevel: WheelRiskLevel;
|
|
22
|
-
segments: WheelSegments;
|
|
23
|
-
}>;
|
|
24
|
-
export declare const WHEEL_SELECTIONS: readonly WheelSelection[];
|
|
25
|
-
export declare const isWheelRiskLevel: (value: unknown) => value is WheelRiskLevel;
|
|
26
|
-
export declare const isWheelSegments: (value: unknown) => value is WheelSegments;
|
|
27
|
-
//#endregion
|
|
28
|
-
//#region src/wheel.multipliers.d.ts
|
|
29
|
-
type WheelSlotValues = Partial<Record<WheelSlot, number>>;
|
|
30
|
-
export declare const wheelMultipliers: MultiplierContainer<Record<WheelRiskLevel, Record<WheelSegments, Partial<Record<"ZERO" | "A" | "B" | "C" | "D" | "E", number>>>>>;
|
|
31
|
-
//#endregion
|
|
32
|
-
//#region src/wheel.outcomes.d.ts
|
|
33
|
-
export type WheelOutcome = Outcome<WheelSlot>;
|
|
34
|
-
export type WheelOutcomeDistribution = OutcomeDistribution<WheelSlot>;
|
|
35
|
-
export declare const validateWheelSelection: ({ riskLevel, segments }: WheelSelection) => void;
|
|
36
|
-
export declare const getWheelPattern: ({ riskLevel, segments }: WheelSelection) => readonly WheelSlot[];
|
|
37
|
-
export declare const getWheelSlotValues: ({ riskLevel, segments }: WheelSelection, edge: number) => WheelSlotValues;
|
|
38
|
-
export declare const getWheelSlotMultiplier: (slotValues: WheelSlotValues, slot: WheelSlot) => Big$1;
|
|
39
|
-
export declare const getWheelSegmentMultipliers: (selection: WheelSelection, edge: number) => Big$1[];
|
|
40
|
-
export declare const describeWheelOutcomes: (selection: WheelSelection, edge: number) => WheelOutcomeDistribution;
|
|
41
|
-
export declare const getWheelMaxMultiplier: (edge: number, selection?: WheelSelection) => Big$1;
|
|
42
|
-
/**
|
|
43
|
-
* The return to player of a selection as a fraction of the stake, kept exact.
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* calculateWheelRtpFraction(selection, 2); // Big('0.98') for a nominal 2% edge, not 98
|
|
47
|
-
* calculateWheelRtpFraction(selection, 2).times(100).toFixed(2); // '98.00', only at the point of display
|
|
48
|
-
*/
|
|
49
|
-
export declare const calculateWheelRtpFraction: (selection: WheelSelection, edge: number) => Big$1;
|
|
50
|
-
//#endregion
|
|
51
|
-
//#region src/wheel.d.ts
|
|
52
|
-
export interface WheelGameInputs {
|
|
53
|
-
segments: WheelSegments;
|
|
54
|
-
riskLevel: WheelRiskLevel;
|
|
55
|
-
betAmount: Big;
|
|
56
|
-
}
|
|
57
|
-
export declare class Wheel extends SingleActionGame<WheelGameInputs> implements DescribesOutcomes<WheelSelection, WheelSlot> {
|
|
58
|
-
constructor();
|
|
59
|
-
get supportedEdgeConfigurations(): [number, ...number[]];
|
|
60
|
-
getBetAmount(gameInputs: WheelGameInputs): Big;
|
|
61
|
-
describeOutcomes(selection: WheelSelection, edge: number): WheelOutcomeDistribution;
|
|
62
|
-
protected determineGameResult({ generator, gameInputs, edge }: GetGameResultRequest<WheelGameInputs>): GameResult;
|
|
63
|
-
}
|
|
64
|
-
export declare const wheelDescriptor: GameDescriptor<WheelGameInputs>;
|
|
65
|
-
//#endregion
|
|
1
|
+
import { C as isWheelRiskLevel, S as WheelSlot, _ as WHEEL_SELECTIONS, a as calculateWheelRtpFraction, b as WheelSegments, c as getWheelPattern, d as getWheelSlotValues, f as validateWheelSelection, g as WHEEL_SEGMENT_OPTIONS, h as WHEEL_RISK_LEVELS, i as WheelOutcomeDistribution, l as getWheelSegmentMultipliers, m as wheelMultipliers, n as WheelGameInputs, o as describeWheelOutcomes, p as WheelSlotValues, r as WheelOutcome, s as getWheelMaxMultiplier, t as Wheel, u as getWheelSlotMultiplier, v as WHEEL_SLOTS, w as isWheelSegments, x as WheelSelection, y as WheelRiskLevel } from "./wheel-Cr_6CS0C.js";
|
|
66
2
|
//#region src/wheel.patterns.d.ts
|
|
67
3
|
export declare const FIXED_PATTERNS: Record<WheelRiskLevel, Record<WheelSegments, readonly WheelSlot[]>>;
|
|
68
4
|
export declare const getFullWheelPattern: (riskLevel: WheelRiskLevel, segment: WheelSegments) => readonly ("ZERO" | "A" | "B" | "C" | "D" | "E")[];
|
|
69
5
|
//#endregion
|
|
70
|
-
export type
|
|
6
|
+
export { WHEEL_RISK_LEVELS, WHEEL_SEGMENT_OPTIONS, WHEEL_SELECTIONS, WHEEL_SLOTS, Wheel, WheelGameInputs, WheelOutcome, WheelOutcomeDistribution, WheelRiskLevel, WheelSegments, WheelSelection, WheelSlot, type WheelSlotValues, calculateWheelRtpFraction, describeWheelOutcomes, getWheelMaxMultiplier, getWheelPattern, getWheelSegmentMultipliers, getWheelSlotMultiplier, getWheelSlotValues, isWheelRiskLevel, isWheelSegments, validateWheelSelection, wheelMultipliers };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{_ as e,a as t,b as n,c as r,d as i,f as a,g as o,h as s,i as c,l,m as u,n as d,o as f,p,r as m,s as h,t as g,u as _,v,y}from"./wheel-Bz3jdq73.mjs";export{_ as FIXED_PATTERNS,p as WHEEL_RISK_LEVELS,u as WHEEL_SEGMENT_OPTIONS,s as WHEEL_SELECTIONS,o as WHEEL_SLOTS,g as Wheel,e as WheelRiskLevel,v as WheelSegments,d as calculateWheelRtpFraction,m as describeWheelOutcomes,i as getFullWheelPattern,c as getWheelMaxMultiplier,t as getWheelPattern,f as getWheelSegmentMultipliers,h as getWheelSlotMultiplier,r as getWheelSlotValues,y as isWheelRiskLevel,n as isWheelSegments,l as validateWheelSelection,a as wheelMultipliers};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Guard as e}from"@betorigami/guard";import{GameError as t,MultiplierContainer as n,OrigamiGame as r,SingleActionGame as i,maxMultiplierOf as a,rtpOf as o}from"@betorigami/game-engine";import s from"big.js";let c=function(e){return e.LOW_RISK=`LOW_RISK`,e.MEDIUM_RISK=`MEDIUM_RISK`,e.HIGH_RISK=`HIGH_RISK`,e}({}),l=function(e){return e[e.TEN=10]=`TEN`,e[e.TWENTY=20]=`TWENTY`,e[e.THIRTY=30]=`THIRTY`,e[e.FORTY=40]=`FORTY`,e[e.FIFTY=50]=`FIFTY`,e}({});const u=[`ZERO`,`A`,`B`,`C`,`D`,`E`],d=[`LOW_RISK`,`MEDIUM_RISK`,`HIGH_RISK`],f=[10,20,30,40,50],p=d.flatMap(e=>f.map(t=>({riskLevel:e,segments:t}))),m=e=>d.some(t=>t===e),h=e=>f.some(t=>t===e),g=new n(new Map([[1,{LOW_RISK:{10:{ZERO:0,A:1.2,B:1.5},20:{ZERO:0,A:1.2,B:1.5},30:{ZERO:0,A:1.2,B:1.5},40:{ZERO:0,A:1.2,B:1.5},50:{ZERO:0,A:1.2,B:1.5}},MEDIUM_RISK:{10:{ZERO:0,A:1.5,B:1.9,C:2,D:3},20:{ZERO:0,A:1.5,B:1.8,C:2,D:3},30:{ZERO:0,A:1.5,B:1.7,C:2,D:3,E:4},40:{ZERO:0,A:1.5,B:1.6,C:2,D:3},50:{ZERO:0,A:1.5,B:2,C:3,D:5}},HIGH_RISK:{10:{ZERO:0,A:9.9},20:{ZERO:0,A:19.8},30:{ZERO:0,A:29.7},40:{ZERO:0,A:39.6},50:{ZERO:0,A:49.5}}}],[2,{LOW_RISK:{10:{ZERO:0,A:1.2,B:1.4},20:{ZERO:0,A:1.2,B:1.4},30:{ZERO:0,A:1.2,B:1.4},40:{ZERO:0,A:1.2,B:1.4},50:{ZERO:0,A:1.2,B:1.4}},MEDIUM_RISK:{10:{ZERO:0,A:1.4,B:1.9,C:2,D:3.1},20:{ZERO:0,A:1.5,B:1.8,C:1.9,D:3.4},30:{ZERO:0,A:1.5,B:1.7,C:1.9,D:3,E:4.3},40:{ZERO:0,A:1.5,B:1.6,C:2,D:2.9},50:{ZERO:0,A:1.5,B:2,C:3,D:4.5}},HIGH_RISK:{10:{ZERO:0,A:9.8},20:{ZERO:0,A:19.6},30:{ZERO:0,A:29.4},40:{ZERO:0,A:39.2},50:{ZERO:0,A:49}}}],[3,{LOW_RISK:{10:{ZERO:0,A:1.15,B:1.65},20:{ZERO:0,A:1.15,B:1.65},30:{ZERO:0,A:1.15,B:1.65},40:{ZERO:0,A:1.15,B:1.65},50:{ZERO:0,A:1.15,B:1.65}},MEDIUM_RISK:{10:{ZERO:0,A:1.4,B:1.9,C:2,D:3},20:{ZERO:0,A:1.4,B:1.6,C:2,D:3},30:{ZERO:0,A:1.4,B:1.7,C:2,D:3,E:4},40:{ZERO:0,A:1.5,B:1.6,C:2,D:2.8},50:{ZERO:0,A:1.5,B:2,C:2.7,D:4.9}},HIGH_RISK:{10:{ZERO:0,A:9.7},20:{ZERO:0,A:19.4},30:{ZERO:0,A:29.1},40:{ZERO:0,A:38.8},50:{ZERO:0,A:48.5}}}],[4,{LOW_RISK:{10:{ZERO:0,A:1.15,B:1.55},20:{ZERO:0,A:1.15,B:1.55},30:{ZERO:0,A:1.15,B:1.55},40:{ZERO:0,A:1.15,B:1.55},50:{ZERO:0,A:1.15,B:1.55}},MEDIUM_RISK:{10:{ZERO:0,A:1.4,B:1.8,C:2,D:3},20:{ZERO:0,A:1.3,B:1.5,C:2,D:3},30:{ZERO:0,A:1.4,B:1.6,C:2,D:2.9,E:4},40:{ZERO:0,A:1.5,B:1.6,C:2,D:2.7},50:{ZERO:0,A:1.5,B:2,C:2.6,D:4.8}},HIGH_RISK:{10:{ZERO:0,A:9.6},20:{ZERO:0,A:19.2},30:{ZERO:0,A:28.8},40:{ZERO:0,A:38.4},50:{ZERO:0,A:48}}}],[8,{LOW_RISK:{10:{ZERO:0,A:1.1,B:1.5},20:{ZERO:0,A:1.1,B:1.5},30:{ZERO:0,A:1.1,B:1.45},40:{ZERO:0,A:1.1,B:1.45},50:{ZERO:0,A:1.1,B:1.45}},MEDIUM_RISK:{10:{ZERO:0,A:1.3,B:1.7,C:1.9,D:3},20:{ZERO:0,A:1.3,B:1.4,C:1.9,D:3},30:{ZERO:0,A:1.3,B:1.7,C:1.9,D:2.8,E:3.8},40:{ZERO:0,A:1.4,B:1.8,C:1.9,D:2.6},50:{ZERO:0,A:1.4,B:1.9,C:2.6,D:4.6}},HIGH_RISK:{10:{ZERO:0,A:9.2},20:{ZERO:0,A:18.4},30:{ZERO:0,A:27.6},40:{ZERO:0,A:36.8},50:{ZERO:0,A:46}}}]])),_={LOW_RISK:{10:[`B`,`A`,`A`,`A`,`ZERO`,`A`,`A`,`A`,`A`,`ZERO`],20:[`B`,`A`,`A`,`A`,`ZERO`,`A`,`A`,`A`,`A`,`ZERO`,`B`,`A`,`A`,`A`,`ZERO`,`A`,`A`,`A`,`A`,`ZERO`],30:`B.A.A.A.ZERO.A.A.A.A.ZERO.B.A.A.A.ZERO.A.A.A.A.ZERO.B.A.A.A.ZERO.A.A.A.A.ZERO`.split(`.`),40:`B.A.A.A.ZERO.A.A.A.A.ZERO.B.A.A.A.ZERO.A.A.A.A.ZERO.B.A.A.A.ZERO.A.A.A.A.ZERO.B.A.A.A.ZERO.A.A.A.A.ZERO`.split(`.`),50:`B.A.A.A.ZERO.A.A.A.A.ZERO.B.A.A.A.ZERO.A.A.A.A.ZERO.B.A.A.A.ZERO.A.A.A.A.ZERO.B.A.A.A.ZERO.A.A.A.A.ZERO.B.A.A.A.ZERO.A.A.A.A.ZERO`.split(`.`)},MEDIUM_RISK:{10:[`ZERO`,`B`,`ZERO`,`A`,`ZERO`,`C`,`ZERO`,`A`,`ZERO`,`D`],20:[`A`,`ZERO`,`C`,`ZERO`,`B`,`ZERO`,`C`,`ZERO`,`C`,`ZERO`,`A`,`ZERO`,`C`,`ZERO`,`C`,`ZERO`,`D`,`ZERO`,`C`,`ZERO`],30:`A.ZERO.C.ZERO.A.ZERO.C.ZERO.D.ZERO.B.ZERO.A.ZERO.C.ZERO.A.ZERO.C.ZERO.A.ZERO.C.ZERO.E.ZERO.A.ZERO.C.ZERO`.split(`.`),40:`C.ZERO.A.ZERO.D.ZERO.C.ZERO.A.ZERO.C.ZERO.A.ZERO.D.ZERO.C.ZERO.A.ZERO.B.ZERO.A.ZERO.D.ZERO.C.ZERO.A.ZERO.C.ZERO.A.ZERO.D.ZERO.C.ZERO.A.ZERO`.split(`.`),50:`A.ZERO.B.ZERO.A.ZERO.C.ZERO.A.ZERO.B.ZERO.A.ZERO.B.ZERO.A.ZERO.C.ZERO.A.ZERO.B.ZERO.A.ZERO.B.ZERO.A.ZERO.C.ZERO.A.ZERO.B.ZERO.A.ZERO.B.ZERO.A.ZERO.D.ZERO.A.ZERO.B.ZERO.A.ZERO`.split(`.`)},HIGH_RISK:{10:[...Array(9).fill(`ZERO`),`A`],20:[...Array(19).fill(`ZERO`),`A`],30:[...Array(29).fill(`ZERO`),`A`],40:[...Array(39).fill(`ZERO`),`A`],50:[...Array(49).fill(`ZERO`),`A`]}},v=(e,t)=>_[e][t],y=({riskLevel:n,segments:r})=>{e.against(!m(n),()=>t.createValidationError(`Invalid risk level ${String(n)}`)),e.against(!h(r),()=>t.createValidationError(`Invalid segments value ${String(r)}`))},b=({riskLevel:e,segments:t})=>_[e][t],x=({riskLevel:e,segments:t},n)=>g.getMultipliers(n)[e][t],S=(t,n)=>{let r=t[n];return e.againstUndefined(r,`No multiplier found for slot ${n}`),s(r)},C=(e,t)=>{let n=x(e,t);return b(e).map(e=>S(n,e))},w=(e,t)=>{let n=b(e),r=x(e,t),i=new Map;for(let e of n)i.set(e,(i.get(e)??0)+1);return{outcomes:Array.from(i,([e,t])=>({slot:e,multiplier:S(r,e),weight:t})).sort((e,t)=>e.multiplier.cmp(t.multiplier)),totalWeight:n.length}},T=(e,t)=>(t===void 0?p:[t]).map(t=>a(w(t,e))).reduce((e,t)=>t.gt(e)?t:e),E=(e,t)=>o(w(e,t));var D=class extends i{constructor(){super(r.WHEEL)}get supportedEdgeConfigurations(){return[1,2,3,4,8]}getBetAmount(e){return e.betAmount}describeOutcomes(e,t){return w(e,t)}determineGameResult({generator:t,gameInputs:n,edge:r}){y(n);let i=b(n),a=x(n,r),o=t.getRandomInt({min:0,max:i.length-1}),s=i[o.value];e.againstUndefined(s,`No slot found at index ${o.value} for ${n.segments} segments`);let c=S(a,s);return{isFinished:!0,payout:{legs:[{amount:n.betAmount.mul(c)}]},payoutMultiplier:c,outputs:{result:o.values},randomValues:o}}};export{c as _,b as a,h as b,x as c,v as d,g as f,u as g,p as h,T as i,y as l,f as m,E as n,C as o,d as p,w as r,S as s,D as t,_ as u,l as v,m as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));let c=require("@betorigami/guard"),l=require("@betorigami/game-engine"),u=require("big.js");u=s(u,1);let d=function(e){return e.LOW_RISK=`LOW_RISK`,e.MEDIUM_RISK=`MEDIUM_RISK`,e.HIGH_RISK=`HIGH_RISK`,e}({}),f=function(e){return e[e.TEN=10]=`TEN`,e[e.TWENTY=20]=`TWENTY`,e[e.THIRTY=30]=`THIRTY`,e[e.FORTY=40]=`FORTY`,e[e.FIFTY=50]=`FIFTY`,e}({});const p=[`ZERO`,`A`,`B`,`C`,`D`,`E`],m=[`LOW_RISK`,`MEDIUM_RISK`,`HIGH_RISK`],h=[10,20,30,40,50],g=m.flatMap(e=>h.map(t=>({riskLevel:e,segments:t}))),_=e=>m.some(t=>t===e),v=e=>h.some(t=>t===e),y=new l.MultiplierContainer(new Map([[1,{LOW_RISK:{10:{ZERO:0,A:1.2,B:1.5},20:{ZERO:0,A:1.2,B:1.5},30:{ZERO:0,A:1.2,B:1.5},40:{ZERO:0,A:1.2,B:1.5},50:{ZERO:0,A:1.2,B:1.5}},MEDIUM_RISK:{10:{ZERO:0,A:1.5,B:1.9,C:2,D:3},20:{ZERO:0,A:1.5,B:1.8,C:2,D:3},30:{ZERO:0,A:1.5,B:1.7,C:2,D:3,E:4},40:{ZERO:0,A:1.5,B:1.6,C:2,D:3},50:{ZERO:0,A:1.5,B:2,C:3,D:5}},HIGH_RISK:{10:{ZERO:0,A:9.9},20:{ZERO:0,A:19.8},30:{ZERO:0,A:29.7},40:{ZERO:0,A:39.6},50:{ZERO:0,A:49.5}}}],[2,{LOW_RISK:{10:{ZERO:0,A:1.2,B:1.4},20:{ZERO:0,A:1.2,B:1.4},30:{ZERO:0,A:1.2,B:1.4},40:{ZERO:0,A:1.2,B:1.4},50:{ZERO:0,A:1.2,B:1.4}},MEDIUM_RISK:{10:{ZERO:0,A:1.4,B:1.9,C:2,D:3.1},20:{ZERO:0,A:1.5,B:1.8,C:1.9,D:3.4},30:{ZERO:0,A:1.5,B:1.7,C:1.9,D:3,E:4.3},40:{ZERO:0,A:1.5,B:1.6,C:2,D:2.9},50:{ZERO:0,A:1.5,B:2,C:3,D:4.5}},HIGH_RISK:{10:{ZERO:0,A:9.8},20:{ZERO:0,A:19.6},30:{ZERO:0,A:29.4},40:{ZERO:0,A:39.2},50:{ZERO:0,A:49}}}],[3,{LOW_RISK:{10:{ZERO:0,A:1.15,B:1.65},20:{ZERO:0,A:1.15,B:1.65},30:{ZERO:0,A:1.15,B:1.65},40:{ZERO:0,A:1.15,B:1.65},50:{ZERO:0,A:1.15,B:1.65}},MEDIUM_RISK:{10:{ZERO:0,A:1.4,B:1.9,C:2,D:3},20:{ZERO:0,A:1.4,B:1.6,C:2,D:3},30:{ZERO:0,A:1.4,B:1.7,C:2,D:3,E:4},40:{ZERO:0,A:1.5,B:1.6,C:2,D:2.8},50:{ZERO:0,A:1.5,B:2,C:2.7,D:4.9}},HIGH_RISK:{10:{ZERO:0,A:9.7},20:{ZERO:0,A:19.4},30:{ZERO:0,A:29.1},40:{ZERO:0,A:38.8},50:{ZERO:0,A:48.5}}}],[4,{LOW_RISK:{10:{ZERO:0,A:1.15,B:1.55},20:{ZERO:0,A:1.15,B:1.55},30:{ZERO:0,A:1.15,B:1.55},40:{ZERO:0,A:1.15,B:1.55},50:{ZERO:0,A:1.15,B:1.55}},MEDIUM_RISK:{10:{ZERO:0,A:1.4,B:1.8,C:2,D:3},20:{ZERO:0,A:1.3,B:1.5,C:2,D:3},30:{ZERO:0,A:1.4,B:1.6,C:2,D:2.9,E:4},40:{ZERO:0,A:1.5,B:1.6,C:2,D:2.7},50:{ZERO:0,A:1.5,B:2,C:2.6,D:4.8}},HIGH_RISK:{10:{ZERO:0,A:9.6},20:{ZERO:0,A:19.2},30:{ZERO:0,A:28.8},40:{ZERO:0,A:38.4},50:{ZERO:0,A:48}}}],[8,{LOW_RISK:{10:{ZERO:0,A:1.1,B:1.5},20:{ZERO:0,A:1.1,B:1.5},30:{ZERO:0,A:1.1,B:1.45},40:{ZERO:0,A:1.1,B:1.45},50:{ZERO:0,A:1.1,B:1.45}},MEDIUM_RISK:{10:{ZERO:0,A:1.3,B:1.7,C:1.9,D:3},20:{ZERO:0,A:1.3,B:1.4,C:1.9,D:3},30:{ZERO:0,A:1.3,B:1.7,C:1.9,D:2.8,E:3.8},40:{ZERO:0,A:1.4,B:1.8,C:1.9,D:2.6},50:{ZERO:0,A:1.4,B:1.9,C:2.6,D:4.6}},HIGH_RISK:{10:{ZERO:0,A:9.2},20:{ZERO:0,A:18.4},30:{ZERO:0,A:27.6},40:{ZERO:0,A:36.8},50:{ZERO:0,A:46}}}]])),b={LOW_RISK:{10:[`B`,`A`,`A`,`A`,`ZERO`,`A`,`A`,`A`,`A`,`ZERO`],20:[`B`,`A`,`A`,`A`,`ZERO`,`A`,`A`,`A`,`A`,`ZERO`,`B`,`A`,`A`,`A`,`ZERO`,`A`,`A`,`A`,`A`,`ZERO`],30:`B.A.A.A.ZERO.A.A.A.A.ZERO.B.A.A.A.ZERO.A.A.A.A.ZERO.B.A.A.A.ZERO.A.A.A.A.ZERO`.split(`.`),40:`B.A.A.A.ZERO.A.A.A.A.ZERO.B.A.A.A.ZERO.A.A.A.A.ZERO.B.A.A.A.ZERO.A.A.A.A.ZERO.B.A.A.A.ZERO.A.A.A.A.ZERO`.split(`.`),50:`B.A.A.A.ZERO.A.A.A.A.ZERO.B.A.A.A.ZERO.A.A.A.A.ZERO.B.A.A.A.ZERO.A.A.A.A.ZERO.B.A.A.A.ZERO.A.A.A.A.ZERO.B.A.A.A.ZERO.A.A.A.A.ZERO`.split(`.`)},MEDIUM_RISK:{10:[`ZERO`,`B`,`ZERO`,`A`,`ZERO`,`C`,`ZERO`,`A`,`ZERO`,`D`],20:[`A`,`ZERO`,`C`,`ZERO`,`B`,`ZERO`,`C`,`ZERO`,`C`,`ZERO`,`A`,`ZERO`,`C`,`ZERO`,`C`,`ZERO`,`D`,`ZERO`,`C`,`ZERO`],30:`A.ZERO.C.ZERO.A.ZERO.C.ZERO.D.ZERO.B.ZERO.A.ZERO.C.ZERO.A.ZERO.C.ZERO.A.ZERO.C.ZERO.E.ZERO.A.ZERO.C.ZERO`.split(`.`),40:`C.ZERO.A.ZERO.D.ZERO.C.ZERO.A.ZERO.C.ZERO.A.ZERO.D.ZERO.C.ZERO.A.ZERO.B.ZERO.A.ZERO.D.ZERO.C.ZERO.A.ZERO.C.ZERO.A.ZERO.D.ZERO.C.ZERO.A.ZERO`.split(`.`),50:`A.ZERO.B.ZERO.A.ZERO.C.ZERO.A.ZERO.B.ZERO.A.ZERO.B.ZERO.A.ZERO.C.ZERO.A.ZERO.B.ZERO.A.ZERO.B.ZERO.A.ZERO.C.ZERO.A.ZERO.B.ZERO.A.ZERO.B.ZERO.A.ZERO.D.ZERO.A.ZERO.B.ZERO.A.ZERO`.split(`.`)},HIGH_RISK:{10:[...Array(9).fill(`ZERO`),`A`],20:[...Array(19).fill(`ZERO`),`A`],30:[...Array(29).fill(`ZERO`),`A`],40:[...Array(39).fill(`ZERO`),`A`],50:[...Array(49).fill(`ZERO`),`A`]}},x=(e,t)=>b[e][t],S=({riskLevel:e,segments:t})=>{c.Guard.against(!_(e),()=>l.GameError.createValidationError(`Invalid risk level ${String(e)}`)),c.Guard.against(!v(t),()=>l.GameError.createValidationError(`Invalid segments value ${String(t)}`))},C=({riskLevel:e,segments:t})=>b[e][t],w=({riskLevel:e,segments:t},n)=>y.getMultipliers(n)[e][t],T=(e,t)=>{let n=e[t];return c.Guard.againstUndefined(n,`No multiplier found for slot ${t}`),(0,u.default)(n)},E=(e,t)=>{let n=w(e,t);return C(e).map(e=>T(n,e))},D=(e,t)=>{let n=C(e),r=w(e,t),i=new Map;for(let e of n)i.set(e,(i.get(e)??0)+1);return{outcomes:Array.from(i,([e,t])=>({slot:e,multiplier:T(r,e),weight:t})).sort((e,t)=>e.multiplier.cmp(t.multiplier)),totalWeight:n.length}},O=(e,t)=>(t===void 0?g:[t]).map(t=>(0,l.maxMultiplierOf)(D(t,e))).reduce((e,t)=>t.gt(e)?t:e),k=(e,t)=>(0,l.rtpOf)(D(e,t));var A=class extends l.SingleActionGame{constructor(){super(l.OrigamiGame.WHEEL)}get supportedEdgeConfigurations(){return[1,2,3,4,8]}getBetAmount(e){return e.betAmount}describeOutcomes(e,t){return D(e,t)}determineGameResult({generator:e,gameInputs:t,edge:n}){S(t);let r=C(t),i=w(t,n),a=e.getRandomInt({min:0,max:r.length-1}),o=r[a.value];c.Guard.againstUndefined(o,`No slot found at index ${a.value} for ${t.segments} segments`);let s=T(i,o);return{isFinished:!0,payout:{legs:[{amount:t.betAmount.mul(s)}]},payoutMultiplier:s,outputs:{result:a.values},randomValues:a}}};Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return _}});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { DescribesOutcomes, GameResult, GetGameResultRequest, MultiplierContainer, Outcome, OutcomeDistribution, SingleActionGame } from "@betorigami/game-engine";
|
|
2
|
+
import Big$1, { Big } from "big.js";
|
|
3
|
+
//#region src/wheel.constants.d.ts
|
|
4
|
+
declare enum WheelRiskLevel {
|
|
5
|
+
LOW_RISK = "LOW_RISK",
|
|
6
|
+
MEDIUM_RISK = "MEDIUM_RISK",
|
|
7
|
+
HIGH_RISK = "HIGH_RISK"
|
|
8
|
+
}
|
|
9
|
+
declare enum WheelSegments {
|
|
10
|
+
TEN = 10,
|
|
11
|
+
TWENTY = 20,
|
|
12
|
+
THIRTY = 30,
|
|
13
|
+
FORTY = 40,
|
|
14
|
+
FIFTY = 50
|
|
15
|
+
}
|
|
16
|
+
declare const WHEEL_SLOTS: readonly ["ZERO", "A", "B", "C", "D", "E"];
|
|
17
|
+
type WheelSlot = (typeof WHEEL_SLOTS)[number];
|
|
18
|
+
declare const WHEEL_RISK_LEVELS: readonly WheelRiskLevel[];
|
|
19
|
+
declare const WHEEL_SEGMENT_OPTIONS: readonly WheelSegments[];
|
|
20
|
+
type WheelSelection = Readonly<{
|
|
21
|
+
riskLevel: WheelRiskLevel;
|
|
22
|
+
segments: WheelSegments;
|
|
23
|
+
}>;
|
|
24
|
+
declare const WHEEL_SELECTIONS: readonly WheelSelection[];
|
|
25
|
+
declare const isWheelRiskLevel: (value: unknown) => value is WheelRiskLevel;
|
|
26
|
+
declare const isWheelSegments: (value: unknown) => value is WheelSegments;
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/wheel.multipliers.d.ts
|
|
29
|
+
type WheelSlotValues = Partial<Record<WheelSlot, number>>;
|
|
30
|
+
declare const wheelMultipliers: MultiplierContainer<Record<WheelRiskLevel, Record<WheelSegments, Partial<Record<"ZERO" | "A" | "B" | "C" | "D" | "E", number>>>>>;
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/wheel.outcomes.d.ts
|
|
33
|
+
type WheelOutcome = Outcome<WheelSlot>;
|
|
34
|
+
type WheelOutcomeDistribution = OutcomeDistribution<WheelSlot>;
|
|
35
|
+
declare const validateWheelSelection: ({ riskLevel, segments }: WheelSelection) => void;
|
|
36
|
+
declare const getWheelPattern: ({ riskLevel, segments }: WheelSelection) => readonly WheelSlot[];
|
|
37
|
+
declare const getWheelSlotValues: ({ riskLevel, segments }: WheelSelection, edge: number) => WheelSlotValues;
|
|
38
|
+
declare const getWheelSlotMultiplier: (slotValues: WheelSlotValues, slot: WheelSlot) => Big$1;
|
|
39
|
+
declare const getWheelSegmentMultipliers: (selection: WheelSelection, edge: number) => Big$1[];
|
|
40
|
+
declare const describeWheelOutcomes: (selection: WheelSelection, edge: number) => WheelOutcomeDistribution;
|
|
41
|
+
declare const getWheelMaxMultiplier: (edge: number, selection?: WheelSelection) => Big$1;
|
|
42
|
+
/**
|
|
43
|
+
* The return to player of a selection as a fraction of the stake, kept exact.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* calculateWheelRtpFraction(selection, 2); // Big('0.98') for a nominal 2% edge, not 98
|
|
47
|
+
* calculateWheelRtpFraction(selection, 2).times(100).toFixed(2); // '98.00', only at the point of display
|
|
48
|
+
*/
|
|
49
|
+
declare const calculateWheelRtpFraction: (selection: WheelSelection, edge: number) => Big$1;
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/wheel.d.ts
|
|
52
|
+
interface WheelGameInputs {
|
|
53
|
+
segments: WheelSegments;
|
|
54
|
+
riskLevel: WheelRiskLevel;
|
|
55
|
+
betAmount: Big;
|
|
56
|
+
}
|
|
57
|
+
declare class Wheel extends SingleActionGame<WheelGameInputs> implements DescribesOutcomes<WheelSelection, WheelSlot> {
|
|
58
|
+
constructor();
|
|
59
|
+
get supportedEdgeConfigurations(): [number, ...number[]];
|
|
60
|
+
getBetAmount(gameInputs: WheelGameInputs): Big;
|
|
61
|
+
describeOutcomes(selection: WheelSelection, edge: number): WheelOutcomeDistribution;
|
|
62
|
+
protected determineGameResult({ generator, gameInputs, edge }: GetGameResultRequest<WheelGameInputs>): GameResult;
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
export { isWheelRiskLevel as C, WheelSlot as S, WHEEL_SELECTIONS as _, calculateWheelRtpFraction as a, WheelSegments as b, getWheelPattern as c, getWheelSlotValues as d, validateWheelSelection as f, WHEEL_SEGMENT_OPTIONS as g, WHEEL_RISK_LEVELS as h, WheelOutcomeDistribution as i, getWheelSegmentMultipliers as l, wheelMultipliers as m, WheelGameInputs as n, describeWheelOutcomes as o, WheelSlotValues as p, WheelOutcome as r, getWheelMaxMultiplier as s, Wheel as t, getWheelSlotMultiplier as u, WHEEL_SLOTS as v, isWheelSegments as w, WheelSelection as x, WheelRiskLevel as y };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { DescribesOutcomes, GameResult, GetGameResultRequest, MultiplierContainer, Outcome, OutcomeDistribution, SingleActionGame } from "@betorigami/game-engine";
|
|
2
|
+
import Big$1, { Big } from "big.js";
|
|
3
|
+
//#region src/wheel.constants.d.ts
|
|
4
|
+
declare enum WheelRiskLevel {
|
|
5
|
+
LOW_RISK = "LOW_RISK",
|
|
6
|
+
MEDIUM_RISK = "MEDIUM_RISK",
|
|
7
|
+
HIGH_RISK = "HIGH_RISK"
|
|
8
|
+
}
|
|
9
|
+
declare enum WheelSegments {
|
|
10
|
+
TEN = 10,
|
|
11
|
+
TWENTY = 20,
|
|
12
|
+
THIRTY = 30,
|
|
13
|
+
FORTY = 40,
|
|
14
|
+
FIFTY = 50
|
|
15
|
+
}
|
|
16
|
+
declare const WHEEL_SLOTS: readonly ["ZERO", "A", "B", "C", "D", "E"];
|
|
17
|
+
type WheelSlot = (typeof WHEEL_SLOTS)[number];
|
|
18
|
+
declare const WHEEL_RISK_LEVELS: readonly WheelRiskLevel[];
|
|
19
|
+
declare const WHEEL_SEGMENT_OPTIONS: readonly WheelSegments[];
|
|
20
|
+
type WheelSelection = Readonly<{
|
|
21
|
+
riskLevel: WheelRiskLevel;
|
|
22
|
+
segments: WheelSegments;
|
|
23
|
+
}>;
|
|
24
|
+
declare const WHEEL_SELECTIONS: readonly WheelSelection[];
|
|
25
|
+
declare const isWheelRiskLevel: (value: unknown) => value is WheelRiskLevel;
|
|
26
|
+
declare const isWheelSegments: (value: unknown) => value is WheelSegments;
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/wheel.multipliers.d.ts
|
|
29
|
+
type WheelSlotValues = Partial<Record<WheelSlot, number>>;
|
|
30
|
+
declare const wheelMultipliers: MultiplierContainer<Record<WheelRiskLevel, Record<WheelSegments, Partial<Record<"ZERO" | "A" | "B" | "C" | "D" | "E", number>>>>>;
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/wheel.outcomes.d.ts
|
|
33
|
+
type WheelOutcome = Outcome<WheelSlot>;
|
|
34
|
+
type WheelOutcomeDistribution = OutcomeDistribution<WheelSlot>;
|
|
35
|
+
declare const validateWheelSelection: ({ riskLevel, segments }: WheelSelection) => void;
|
|
36
|
+
declare const getWheelPattern: ({ riskLevel, segments }: WheelSelection) => readonly WheelSlot[];
|
|
37
|
+
declare const getWheelSlotValues: ({ riskLevel, segments }: WheelSelection, edge: number) => WheelSlotValues;
|
|
38
|
+
declare const getWheelSlotMultiplier: (slotValues: WheelSlotValues, slot: WheelSlot) => Big$1;
|
|
39
|
+
declare const getWheelSegmentMultipliers: (selection: WheelSelection, edge: number) => Big$1[];
|
|
40
|
+
declare const describeWheelOutcomes: (selection: WheelSelection, edge: number) => WheelOutcomeDistribution;
|
|
41
|
+
declare const getWheelMaxMultiplier: (edge: number, selection?: WheelSelection) => Big$1;
|
|
42
|
+
/**
|
|
43
|
+
* The return to player of a selection as a fraction of the stake, kept exact.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* calculateWheelRtpFraction(selection, 2); // Big('0.98') for a nominal 2% edge, not 98
|
|
47
|
+
* calculateWheelRtpFraction(selection, 2).times(100).toFixed(2); // '98.00', only at the point of display
|
|
48
|
+
*/
|
|
49
|
+
declare const calculateWheelRtpFraction: (selection: WheelSelection, edge: number) => Big$1;
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/wheel.d.ts
|
|
52
|
+
interface WheelGameInputs {
|
|
53
|
+
segments: WheelSegments;
|
|
54
|
+
riskLevel: WheelRiskLevel;
|
|
55
|
+
betAmount: Big;
|
|
56
|
+
}
|
|
57
|
+
declare class Wheel extends SingleActionGame<WheelGameInputs> implements DescribesOutcomes<WheelSelection, WheelSlot> {
|
|
58
|
+
constructor();
|
|
59
|
+
get supportedEdgeConfigurations(): [number, ...number[]];
|
|
60
|
+
getBetAmount(gameInputs: WheelGameInputs): Big;
|
|
61
|
+
describeOutcomes(selection: WheelSelection, edge: number): WheelOutcomeDistribution;
|
|
62
|
+
protected determineGameResult({ generator, gameInputs, edge }: GetGameResultRequest<WheelGameInputs>): GameResult;
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
export { isWheelRiskLevel as C, WheelSlot as S, WHEEL_SELECTIONS as _, calculateWheelRtpFraction as a, WheelSegments as b, getWheelPattern as c, getWheelSlotValues as d, validateWheelSelection as f, WHEEL_SEGMENT_OPTIONS as g, WHEEL_RISK_LEVELS as h, WheelOutcomeDistribution as i, getWheelSegmentMultipliers as l, wheelMultipliers as m, WheelGameInputs as n, describeWheelOutcomes as o, WheelSlotValues as p, WheelOutcome as r, getWheelMaxMultiplier as s, Wheel as t, getWheelSlotMultiplier as u, WHEEL_SLOTS as v, isWheelSegments as w, WheelSelection as x, WheelRiskLevel as y };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@betorigami/game-wheel",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
11
|
"require": "./dist/index.cjs",
|
|
12
12
|
"import": "./dist/index.mjs"
|
|
13
|
+
},
|
|
14
|
+
"./definition": {
|
|
15
|
+
"types": "./dist/definition.d.ts",
|
|
16
|
+
"require": "./dist/definition.cjs",
|
|
17
|
+
"import": "./dist/definition.mjs"
|
|
13
18
|
}
|
|
14
19
|
},
|
|
15
20
|
"files": [
|
|
@@ -27,9 +32,10 @@
|
|
|
27
32
|
"vitest": "^3.2.4"
|
|
28
33
|
},
|
|
29
34
|
"dependencies": {
|
|
30
|
-
"@betorigami/game-engine": "
|
|
35
|
+
"@betorigami/game-engine": "3.0.0",
|
|
31
36
|
"@betorigami/guard": "^2.0.7",
|
|
32
|
-
"big.js": "^7.0.1"
|
|
37
|
+
"big.js": "^7.0.1",
|
|
38
|
+
"zod": "4.3.6"
|
|
33
39
|
},
|
|
34
40
|
"scripts": {
|
|
35
41
|
"tsc": "tsc",
|