@slot-engine/core 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +79 -68
- package/dist/index.d.ts +79 -68
- package/dist/index.js +203 -86
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +203 -86
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -89,8 +89,9 @@ declare class Simulation {
|
|
|
89
89
|
private debug;
|
|
90
90
|
private actualSims;
|
|
91
91
|
private library;
|
|
92
|
-
private recorder;
|
|
93
92
|
private wallet;
|
|
93
|
+
private recordsWriteStream;
|
|
94
|
+
private hasWrittenRecord;
|
|
94
95
|
constructor(opts: SimulationOptions, gameConfigOpts: GameConfigOptions);
|
|
95
96
|
runSimulation(opts: SimulationConfigOptions): Promise<void>;
|
|
96
97
|
/**
|
|
@@ -148,13 +149,11 @@ declare class Simulation {
|
|
|
148
149
|
private writeRecords;
|
|
149
150
|
private writeIndexJson;
|
|
150
151
|
private writeBooksJson;
|
|
151
|
-
private logSymbolOccurrences;
|
|
152
152
|
/**
|
|
153
153
|
* Compiles user configured game to JS for use in different Node processes
|
|
154
154
|
*/
|
|
155
155
|
private preprocessFiles;
|
|
156
156
|
private getSimRangesForChunks;
|
|
157
|
-
private mergeRecords;
|
|
158
157
|
/**
|
|
159
158
|
* Generates reelset CSV files for all game modes.
|
|
160
159
|
*/
|
|
@@ -699,6 +698,70 @@ interface GameModeOpts {
|
|
|
699
698
|
isBonusBuy: boolean;
|
|
700
699
|
}
|
|
701
700
|
|
|
701
|
+
declare class WinType {
|
|
702
|
+
protected payout: number;
|
|
703
|
+
protected winCombinations: WinCombination[];
|
|
704
|
+
protected ctx: GameContext;
|
|
705
|
+
protected readonly wildSymbol?: WildSymbol;
|
|
706
|
+
constructor(opts: WinTypeOpts);
|
|
707
|
+
/**
|
|
708
|
+
* Implementation of win evaluation logic. Sets `this.payout` and `this.winCombinations`.
|
|
709
|
+
*/
|
|
710
|
+
evaluateWins(board: Reels): this;
|
|
711
|
+
/**
|
|
712
|
+
* Custom post-processing of wins, e.g. for handling multipliers.
|
|
713
|
+
*/
|
|
714
|
+
postProcess(func: PostProcessFn<typeof this.winCombinations>): this;
|
|
715
|
+
/**
|
|
716
|
+
* Returns the total payout and detailed win combinations.
|
|
717
|
+
*/
|
|
718
|
+
getWins(): {
|
|
719
|
+
payout: number;
|
|
720
|
+
winCombinations: WinCombination[];
|
|
721
|
+
};
|
|
722
|
+
protected isWild(symbol: GameSymbol): boolean;
|
|
723
|
+
protected getSymbolPayout(symbol: GameSymbol, count: number): number;
|
|
724
|
+
}
|
|
725
|
+
interface WinTypeOpts {
|
|
726
|
+
/**
|
|
727
|
+
* A reference to the game context.
|
|
728
|
+
*/
|
|
729
|
+
ctx: GameContext<any, any, any>;
|
|
730
|
+
/**
|
|
731
|
+
* Configuration used to identify wild symbols on the board.\
|
|
732
|
+
* You can either provide a specific `GameSymbol` instance or a set of properties to match against symbols on the board.
|
|
733
|
+
*
|
|
734
|
+
* @example
|
|
735
|
+
* If you have different wild symbols, each with a property `isWild: true`, you can define:
|
|
736
|
+
* ```ts
|
|
737
|
+
* wildSymbol: { isWild: true }
|
|
738
|
+
* ```
|
|
739
|
+
*
|
|
740
|
+
* @example
|
|
741
|
+
* If you have a single wild symbol instance, you can define:
|
|
742
|
+
* ```ts
|
|
743
|
+
* wildSymbol: myWildSymbol
|
|
744
|
+
* ```
|
|
745
|
+
*/
|
|
746
|
+
wildSymbol?: WildSymbol;
|
|
747
|
+
}
|
|
748
|
+
type WinCombination = {
|
|
749
|
+
payout: number;
|
|
750
|
+
kind: number;
|
|
751
|
+
baseSymbol: GameSymbol;
|
|
752
|
+
symbols: Array<{
|
|
753
|
+
symbol: GameSymbol;
|
|
754
|
+
isWild: boolean;
|
|
755
|
+
substitutedFor?: GameSymbol;
|
|
756
|
+
reelIndex: number;
|
|
757
|
+
posIndex: number;
|
|
758
|
+
}>;
|
|
759
|
+
};
|
|
760
|
+
type PostProcessFn<TWinCombs extends WinCombination[]> = (wins: TWinCombs, ctx: GameContext) => {
|
|
761
|
+
winCombinations: TWinCombs;
|
|
762
|
+
};
|
|
763
|
+
type WildSymbol = GameSymbol | Record<string, any>;
|
|
764
|
+
|
|
702
765
|
declare class GameService<TGameModes extends AnyGameModes = AnyGameModes, TSymbols extends AnySymbols = AnySymbols, TUserState extends AnyUserData = AnyUserData> extends AbstractService {
|
|
703
766
|
constructor(ctx: () => GameContext<TGameModes, TSymbols, TUserState>);
|
|
704
767
|
/**
|
|
@@ -737,6 +800,18 @@ declare class GameService<TGameModes extends AnyGameModes = AnyGameModes, TSymbo
|
|
|
737
800
|
* Also sets `state.triggeredFreespins` to true.
|
|
738
801
|
*/
|
|
739
802
|
awardFreespins(amount: number): void;
|
|
803
|
+
/**
|
|
804
|
+
* Dedupes win symbols.
|
|
805
|
+
*
|
|
806
|
+
* Since it may be possible that multiple win combinations include the same symbol (e.g. Wilds),\
|
|
807
|
+
* this method ensures that each symbol is only listed once.
|
|
808
|
+
*
|
|
809
|
+
* If you want to tumble based on winning symbols, run them through this method first.
|
|
810
|
+
*/
|
|
811
|
+
dedupeWinSymbols(winCombinations: WinCombination[]): {
|
|
812
|
+
reelIdx: number;
|
|
813
|
+
rowIdx: number;
|
|
814
|
+
}[];
|
|
740
815
|
}
|
|
741
816
|
|
|
742
817
|
declare class Wallet {
|
|
@@ -1181,70 +1256,6 @@ declare const defineUserState: <TUserState extends AnyUserData>(data: TUserState
|
|
|
1181
1256
|
declare const defineSymbols: <TSymbols extends AnySymbols>(symbols: TSymbols) => TSymbols;
|
|
1182
1257
|
declare const defineGameModes: <TGameModes extends AnyGameModes>(gameModes: TGameModes) => TGameModes;
|
|
1183
1258
|
|
|
1184
|
-
declare class WinType {
|
|
1185
|
-
protected payout: number;
|
|
1186
|
-
protected winCombinations: WinCombination[];
|
|
1187
|
-
protected ctx: GameContext;
|
|
1188
|
-
protected readonly wildSymbol?: WildSymbol;
|
|
1189
|
-
constructor(opts: WinTypeOpts);
|
|
1190
|
-
/**
|
|
1191
|
-
* Implementation of win evaluation logic. Sets `this.payout` and `this.winCombinations`.
|
|
1192
|
-
*/
|
|
1193
|
-
evaluateWins(board: Reels): this;
|
|
1194
|
-
/**
|
|
1195
|
-
* Custom post-processing of wins, e.g. for handling multipliers.
|
|
1196
|
-
*/
|
|
1197
|
-
postProcess(func: PostProcessFn<typeof this.winCombinations>): this;
|
|
1198
|
-
/**
|
|
1199
|
-
* Returns the total payout and detailed win combinations.
|
|
1200
|
-
*/
|
|
1201
|
-
getWins(): {
|
|
1202
|
-
payout: number;
|
|
1203
|
-
winCombinations: WinCombination[];
|
|
1204
|
-
};
|
|
1205
|
-
protected isWild(symbol: GameSymbol): boolean;
|
|
1206
|
-
protected getSymbolPayout(symbol: GameSymbol, count: number): number;
|
|
1207
|
-
}
|
|
1208
|
-
interface WinTypeOpts {
|
|
1209
|
-
/**
|
|
1210
|
-
* A reference to the game context.
|
|
1211
|
-
*/
|
|
1212
|
-
ctx: GameContext<any, any, any>;
|
|
1213
|
-
/**
|
|
1214
|
-
* Configuration used to identify wild symbols on the board.\
|
|
1215
|
-
* You can either provide a specific `GameSymbol` instance or a set of properties to match against symbols on the board.
|
|
1216
|
-
*
|
|
1217
|
-
* @example
|
|
1218
|
-
* If you have different wild symbols, each with a property `isWild: true`, you can define:
|
|
1219
|
-
* ```ts
|
|
1220
|
-
* wildSymbol: { isWild: true }
|
|
1221
|
-
* ```
|
|
1222
|
-
*
|
|
1223
|
-
* @example
|
|
1224
|
-
* If you have a single wild symbol instance, you can define:
|
|
1225
|
-
* ```ts
|
|
1226
|
-
* wildSymbol: myWildSymbol
|
|
1227
|
-
* ```
|
|
1228
|
-
*/
|
|
1229
|
-
wildSymbol?: WildSymbol;
|
|
1230
|
-
}
|
|
1231
|
-
type WinCombination = {
|
|
1232
|
-
payout: number;
|
|
1233
|
-
kind: number;
|
|
1234
|
-
baseSymbol: GameSymbol;
|
|
1235
|
-
symbols: Array<{
|
|
1236
|
-
symbol: GameSymbol;
|
|
1237
|
-
isWild: boolean;
|
|
1238
|
-
substitutedFor?: GameSymbol;
|
|
1239
|
-
reelIndex: number;
|
|
1240
|
-
posIndex: number;
|
|
1241
|
-
}>;
|
|
1242
|
-
};
|
|
1243
|
-
type PostProcessFn<TWinCombs extends WinCombination[]> = (wins: TWinCombs, ctx: GameContext) => {
|
|
1244
|
-
winCombinations: TWinCombs;
|
|
1245
|
-
};
|
|
1246
|
-
type WildSymbol = GameSymbol | Record<string, any>;
|
|
1247
|
-
|
|
1248
1259
|
declare class LinesWinType extends WinType {
|
|
1249
1260
|
protected lines: Record<number, number[]>;
|
|
1250
1261
|
protected winCombinations: LineWinCombination[];
|
|
@@ -1580,4 +1591,4 @@ interface StandaloneBoardOptions {
|
|
|
1580
1591
|
padSymbols: number;
|
|
1581
1592
|
}
|
|
1582
1593
|
|
|
1583
|
-
export { type AnyGameModes, type AnySymbols, type AnyUserData, ClusterWinType, type GameContext, type GameHooks, GameMode, GameSymbol, GeneratedReelSet, type InferGameType, LinesWinType, ManywaysWinType, OptimizationConditions, OptimizationParameters, OptimizationScaling, type Reels, ResultSet, SPIN_TYPE, type SpinType, StandaloneBoard, StaticReelSet, createSlotGame, defineGameModes, defineSymbols, defineUserState };
|
|
1594
|
+
export { type AnyGameModes, type AnySymbols, type AnyUserData, ClusterWinType, type GameContext, type GameHooks, GameMode, GameSymbol, GeneratedReelSet, type InferGameType, LinesWinType, ManywaysWinType, OptimizationConditions, OptimizationParameters, OptimizationScaling, type Reels, ResultSet, SPIN_TYPE, type SpinType, StandaloneBoard, StaticReelSet, type WinCombination, createSlotGame, defineGameModes, defineSymbols, defineUserState };
|
package/dist/index.d.ts
CHANGED
|
@@ -89,8 +89,9 @@ declare class Simulation {
|
|
|
89
89
|
private debug;
|
|
90
90
|
private actualSims;
|
|
91
91
|
private library;
|
|
92
|
-
private recorder;
|
|
93
92
|
private wallet;
|
|
93
|
+
private recordsWriteStream;
|
|
94
|
+
private hasWrittenRecord;
|
|
94
95
|
constructor(opts: SimulationOptions, gameConfigOpts: GameConfigOptions);
|
|
95
96
|
runSimulation(opts: SimulationConfigOptions): Promise<void>;
|
|
96
97
|
/**
|
|
@@ -148,13 +149,11 @@ declare class Simulation {
|
|
|
148
149
|
private writeRecords;
|
|
149
150
|
private writeIndexJson;
|
|
150
151
|
private writeBooksJson;
|
|
151
|
-
private logSymbolOccurrences;
|
|
152
152
|
/**
|
|
153
153
|
* Compiles user configured game to JS for use in different Node processes
|
|
154
154
|
*/
|
|
155
155
|
private preprocessFiles;
|
|
156
156
|
private getSimRangesForChunks;
|
|
157
|
-
private mergeRecords;
|
|
158
157
|
/**
|
|
159
158
|
* Generates reelset CSV files for all game modes.
|
|
160
159
|
*/
|
|
@@ -699,6 +698,70 @@ interface GameModeOpts {
|
|
|
699
698
|
isBonusBuy: boolean;
|
|
700
699
|
}
|
|
701
700
|
|
|
701
|
+
declare class WinType {
|
|
702
|
+
protected payout: number;
|
|
703
|
+
protected winCombinations: WinCombination[];
|
|
704
|
+
protected ctx: GameContext;
|
|
705
|
+
protected readonly wildSymbol?: WildSymbol;
|
|
706
|
+
constructor(opts: WinTypeOpts);
|
|
707
|
+
/**
|
|
708
|
+
* Implementation of win evaluation logic. Sets `this.payout` and `this.winCombinations`.
|
|
709
|
+
*/
|
|
710
|
+
evaluateWins(board: Reels): this;
|
|
711
|
+
/**
|
|
712
|
+
* Custom post-processing of wins, e.g. for handling multipliers.
|
|
713
|
+
*/
|
|
714
|
+
postProcess(func: PostProcessFn<typeof this.winCombinations>): this;
|
|
715
|
+
/**
|
|
716
|
+
* Returns the total payout and detailed win combinations.
|
|
717
|
+
*/
|
|
718
|
+
getWins(): {
|
|
719
|
+
payout: number;
|
|
720
|
+
winCombinations: WinCombination[];
|
|
721
|
+
};
|
|
722
|
+
protected isWild(symbol: GameSymbol): boolean;
|
|
723
|
+
protected getSymbolPayout(symbol: GameSymbol, count: number): number;
|
|
724
|
+
}
|
|
725
|
+
interface WinTypeOpts {
|
|
726
|
+
/**
|
|
727
|
+
* A reference to the game context.
|
|
728
|
+
*/
|
|
729
|
+
ctx: GameContext<any, any, any>;
|
|
730
|
+
/**
|
|
731
|
+
* Configuration used to identify wild symbols on the board.\
|
|
732
|
+
* You can either provide a specific `GameSymbol` instance or a set of properties to match against symbols on the board.
|
|
733
|
+
*
|
|
734
|
+
* @example
|
|
735
|
+
* If you have different wild symbols, each with a property `isWild: true`, you can define:
|
|
736
|
+
* ```ts
|
|
737
|
+
* wildSymbol: { isWild: true }
|
|
738
|
+
* ```
|
|
739
|
+
*
|
|
740
|
+
* @example
|
|
741
|
+
* If you have a single wild symbol instance, you can define:
|
|
742
|
+
* ```ts
|
|
743
|
+
* wildSymbol: myWildSymbol
|
|
744
|
+
* ```
|
|
745
|
+
*/
|
|
746
|
+
wildSymbol?: WildSymbol;
|
|
747
|
+
}
|
|
748
|
+
type WinCombination = {
|
|
749
|
+
payout: number;
|
|
750
|
+
kind: number;
|
|
751
|
+
baseSymbol: GameSymbol;
|
|
752
|
+
symbols: Array<{
|
|
753
|
+
symbol: GameSymbol;
|
|
754
|
+
isWild: boolean;
|
|
755
|
+
substitutedFor?: GameSymbol;
|
|
756
|
+
reelIndex: number;
|
|
757
|
+
posIndex: number;
|
|
758
|
+
}>;
|
|
759
|
+
};
|
|
760
|
+
type PostProcessFn<TWinCombs extends WinCombination[]> = (wins: TWinCombs, ctx: GameContext) => {
|
|
761
|
+
winCombinations: TWinCombs;
|
|
762
|
+
};
|
|
763
|
+
type WildSymbol = GameSymbol | Record<string, any>;
|
|
764
|
+
|
|
702
765
|
declare class GameService<TGameModes extends AnyGameModes = AnyGameModes, TSymbols extends AnySymbols = AnySymbols, TUserState extends AnyUserData = AnyUserData> extends AbstractService {
|
|
703
766
|
constructor(ctx: () => GameContext<TGameModes, TSymbols, TUserState>);
|
|
704
767
|
/**
|
|
@@ -737,6 +800,18 @@ declare class GameService<TGameModes extends AnyGameModes = AnyGameModes, TSymbo
|
|
|
737
800
|
* Also sets `state.triggeredFreespins` to true.
|
|
738
801
|
*/
|
|
739
802
|
awardFreespins(amount: number): void;
|
|
803
|
+
/**
|
|
804
|
+
* Dedupes win symbols.
|
|
805
|
+
*
|
|
806
|
+
* Since it may be possible that multiple win combinations include the same symbol (e.g. Wilds),\
|
|
807
|
+
* this method ensures that each symbol is only listed once.
|
|
808
|
+
*
|
|
809
|
+
* If you want to tumble based on winning symbols, run them through this method first.
|
|
810
|
+
*/
|
|
811
|
+
dedupeWinSymbols(winCombinations: WinCombination[]): {
|
|
812
|
+
reelIdx: number;
|
|
813
|
+
rowIdx: number;
|
|
814
|
+
}[];
|
|
740
815
|
}
|
|
741
816
|
|
|
742
817
|
declare class Wallet {
|
|
@@ -1181,70 +1256,6 @@ declare const defineUserState: <TUserState extends AnyUserData>(data: TUserState
|
|
|
1181
1256
|
declare const defineSymbols: <TSymbols extends AnySymbols>(symbols: TSymbols) => TSymbols;
|
|
1182
1257
|
declare const defineGameModes: <TGameModes extends AnyGameModes>(gameModes: TGameModes) => TGameModes;
|
|
1183
1258
|
|
|
1184
|
-
declare class WinType {
|
|
1185
|
-
protected payout: number;
|
|
1186
|
-
protected winCombinations: WinCombination[];
|
|
1187
|
-
protected ctx: GameContext;
|
|
1188
|
-
protected readonly wildSymbol?: WildSymbol;
|
|
1189
|
-
constructor(opts: WinTypeOpts);
|
|
1190
|
-
/**
|
|
1191
|
-
* Implementation of win evaluation logic. Sets `this.payout` and `this.winCombinations`.
|
|
1192
|
-
*/
|
|
1193
|
-
evaluateWins(board: Reels): this;
|
|
1194
|
-
/**
|
|
1195
|
-
* Custom post-processing of wins, e.g. for handling multipliers.
|
|
1196
|
-
*/
|
|
1197
|
-
postProcess(func: PostProcessFn<typeof this.winCombinations>): this;
|
|
1198
|
-
/**
|
|
1199
|
-
* Returns the total payout and detailed win combinations.
|
|
1200
|
-
*/
|
|
1201
|
-
getWins(): {
|
|
1202
|
-
payout: number;
|
|
1203
|
-
winCombinations: WinCombination[];
|
|
1204
|
-
};
|
|
1205
|
-
protected isWild(symbol: GameSymbol): boolean;
|
|
1206
|
-
protected getSymbolPayout(symbol: GameSymbol, count: number): number;
|
|
1207
|
-
}
|
|
1208
|
-
interface WinTypeOpts {
|
|
1209
|
-
/**
|
|
1210
|
-
* A reference to the game context.
|
|
1211
|
-
*/
|
|
1212
|
-
ctx: GameContext<any, any, any>;
|
|
1213
|
-
/**
|
|
1214
|
-
* Configuration used to identify wild symbols on the board.\
|
|
1215
|
-
* You can either provide a specific `GameSymbol` instance or a set of properties to match against symbols on the board.
|
|
1216
|
-
*
|
|
1217
|
-
* @example
|
|
1218
|
-
* If you have different wild symbols, each with a property `isWild: true`, you can define:
|
|
1219
|
-
* ```ts
|
|
1220
|
-
* wildSymbol: { isWild: true }
|
|
1221
|
-
* ```
|
|
1222
|
-
*
|
|
1223
|
-
* @example
|
|
1224
|
-
* If you have a single wild symbol instance, you can define:
|
|
1225
|
-
* ```ts
|
|
1226
|
-
* wildSymbol: myWildSymbol
|
|
1227
|
-
* ```
|
|
1228
|
-
*/
|
|
1229
|
-
wildSymbol?: WildSymbol;
|
|
1230
|
-
}
|
|
1231
|
-
type WinCombination = {
|
|
1232
|
-
payout: number;
|
|
1233
|
-
kind: number;
|
|
1234
|
-
baseSymbol: GameSymbol;
|
|
1235
|
-
symbols: Array<{
|
|
1236
|
-
symbol: GameSymbol;
|
|
1237
|
-
isWild: boolean;
|
|
1238
|
-
substitutedFor?: GameSymbol;
|
|
1239
|
-
reelIndex: number;
|
|
1240
|
-
posIndex: number;
|
|
1241
|
-
}>;
|
|
1242
|
-
};
|
|
1243
|
-
type PostProcessFn<TWinCombs extends WinCombination[]> = (wins: TWinCombs, ctx: GameContext) => {
|
|
1244
|
-
winCombinations: TWinCombs;
|
|
1245
|
-
};
|
|
1246
|
-
type WildSymbol = GameSymbol | Record<string, any>;
|
|
1247
|
-
|
|
1248
1259
|
declare class LinesWinType extends WinType {
|
|
1249
1260
|
protected lines: Record<number, number[]>;
|
|
1250
1261
|
protected winCombinations: LineWinCombination[];
|
|
@@ -1580,4 +1591,4 @@ interface StandaloneBoardOptions {
|
|
|
1580
1591
|
padSymbols: number;
|
|
1581
1592
|
}
|
|
1582
1593
|
|
|
1583
|
-
export { type AnyGameModes, type AnySymbols, type AnyUserData, ClusterWinType, type GameContext, type GameHooks, GameMode, GameSymbol, GeneratedReelSet, type InferGameType, LinesWinType, ManywaysWinType, OptimizationConditions, OptimizationParameters, OptimizationScaling, type Reels, ResultSet, SPIN_TYPE, type SpinType, StandaloneBoard, StaticReelSet, createSlotGame, defineGameModes, defineSymbols, defineUserState };
|
|
1594
|
+
export { type AnyGameModes, type AnySymbols, type AnyUserData, ClusterWinType, type GameContext, type GameHooks, GameMode, GameSymbol, GeneratedReelSet, type InferGameType, LinesWinType, ManywaysWinType, OptimizationConditions, OptimizationParameters, OptimizationScaling, type Reels, ResultSet, SPIN_TYPE, type SpinType, StandaloneBoard, StaticReelSet, type WinCombination, createSlotGame, defineGameModes, defineSymbols, defineUserState };
|