@slot-engine/core 0.0.9 → 0.0.11

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 CHANGED
@@ -328,6 +328,10 @@ declare class GameSymbol {
328
328
  * Compares this symbol to another symbol or a set of properties.
329
329
  */
330
330
  compare(symbolOrProperties?: GameSymbol | Record<string, any>): boolean;
331
+ /**
332
+ * Creates a clone of this GameSymbol.
333
+ */
334
+ clone(): GameSymbol;
331
335
  }
332
336
  interface GameSymbolOpts {
333
337
  /**
@@ -370,6 +374,14 @@ declare class BoardService<TGameModes extends AnyGameModes = AnyGameModes, TSymb
370
374
  getPaddingTop(): Reels;
371
375
  getPaddingBottom(): Reels;
372
376
  getAnticipation(): boolean[];
377
+ /**
378
+ * Gets the symbol at the specified reel and row index.
379
+ */
380
+ getSymbol(reelIndex: number, rowIndex: number): GameSymbol | undefined;
381
+ /**
382
+ * Sets the symbol at the specified reel and row index.
383
+ */
384
+ setSymbol(reelIndex: number, rowIndex: number, symbol: GameSymbol): void;
373
385
  private resetReels;
374
386
  /**
375
387
  * Sets the anticipation value for a specific reel.
@@ -416,7 +428,11 @@ declare class BoardService<TGameModes extends AnyGameModes = AnyGameModes, TSymb
416
428
  /**
417
429
  * Draws a board using specified reel stops.
418
430
  */
419
- drawBoardWithForcedStops(reels: Reels, forcedStops: Record<string, number>): void;
431
+ drawBoardWithForcedStops(opts: {
432
+ reels: Reels;
433
+ forcedStops: Record<string, number>;
434
+ randomOffset?: boolean;
435
+ }): void;
420
436
  /**
421
437
  * Draws a board using random reel stops.
422
438
  */
@@ -597,7 +613,7 @@ declare class ReelSet {
597
613
  reels: Reels;
598
614
  protected rng: RandomNumberGenerator;
599
615
  constructor(opts: ReelSetOptions);
600
- generateReels(simulation: Simulation): void;
616
+ generateReels(config: GameConfig): ReelSet;
601
617
  /**
602
618
  * Reads a reelset CSV file and returns the reels as arrays of GameSymbols.
603
619
  */
@@ -675,6 +691,11 @@ interface GameModeOpts {
675
691
 
676
692
  declare class GameService<TGameModes extends AnyGameModes = AnyGameModes, TSymbols extends AnySymbols = AnySymbols, TUserState extends AnyUserData = AnyUserData> extends AbstractService {
677
693
  constructor(ctx: () => GameContext<TGameModes, TSymbols, TUserState>);
694
+ /**
695
+ * Intended for internal use only.\
696
+ * Generates reels for all reel sets in the game configuration.
697
+ */
698
+ _generateReels(): void;
678
699
  /**
679
700
  * Retrieves a reel set by its ID within a specific game mode.
680
701
  */
@@ -1171,6 +1192,7 @@ declare class WinType {
1171
1192
  winCombinations: WinCombination[];
1172
1193
  };
1173
1194
  protected isWild(symbol: GameSymbol): boolean;
1195
+ protected getSymbolPayout(symbol: GameSymbol, count: number): number;
1174
1196
  }
1175
1197
  interface WinTypeOpts {
1176
1198
  /**
@@ -1198,6 +1220,7 @@ interface WinTypeOpts {
1198
1220
  type WinCombination = {
1199
1221
  payout: number;
1200
1222
  kind: number;
1223
+ baseSymbol: GameSymbol;
1201
1224
  symbols: Array<{
1202
1225
  symbol: GameSymbol;
1203
1226
  isWild: boolean;
@@ -1226,6 +1249,7 @@ declare class LinesWinType extends WinType {
1226
1249
  * Retrieve the results using `getWins()` after.
1227
1250
  */
1228
1251
  evaluateWins(board: Reels): this;
1252
+ private getLinePayout;
1229
1253
  }
1230
1254
  interface LinesWinTypeOpts extends WinTypeOpts {
1231
1255
  /**
@@ -1244,20 +1268,57 @@ interface LinesWinTypeOpts extends WinTypeOpts {
1244
1268
  }
1245
1269
  interface LineWinCombination extends WinCombination {
1246
1270
  lineNumber: number;
1247
- symbol: GameSymbol;
1248
- winType: "pure-wild" | "substituted";
1249
- substitutedBaseSymbol: GameSymbol | null;
1250
- stats: {
1251
- wildCount: number;
1252
- nonWildCount: number;
1253
- leadingWilds: number;
1254
- };
1255
1271
  }
1256
1272
 
1257
1273
  declare class ClusterWinType extends WinType {
1274
+ protected winCombinations: ClusterWinCombination[];
1275
+ getWins: () => {
1276
+ payout: number;
1277
+ winCombinations: ClusterWinCombination[];
1278
+ };
1279
+ private _checked;
1280
+ private _checkedWilds;
1281
+ private _currentBoard;
1282
+ constructor(opts: ClusterWinTypeOpts);
1283
+ private validateConfig;
1284
+ /**
1285
+ * Calculates wins based on symbol cluster size and provided board state.\
1286
+ * Retrieve the results using `getWins()` after.
1287
+ */
1288
+ evaluateWins(board: Reels): this;
1289
+ private getNeighbors;
1290
+ private evaluateCluster;
1291
+ private isChecked;
1292
+ private isCheckedWild;
1293
+ }
1294
+ interface ClusterWinTypeOpts extends WinTypeOpts {
1295
+ }
1296
+ interface ClusterWinCombination extends WinCombination {
1258
1297
  }
1259
1298
 
1260
1299
  declare class ManywaysWinType extends WinType {
1300
+ protected winCombinations: ManywaysWinCombination[];
1301
+ getWins: () => {
1302
+ payout: number;
1303
+ winCombinations: ManywaysWinCombination[];
1304
+ };
1305
+ private _checked;
1306
+ private _checkedWilds;
1307
+ constructor(opts: ManywaysWinTypeOpts);
1308
+ private validateConfig;
1309
+ /**
1310
+ * Calculates wins based on the defined paylines and provided board state.\
1311
+ * Retrieve the results using `getWins()` after.
1312
+ */
1313
+ evaluateWins(board: Reels): this;
1314
+ private getWayLength;
1315
+ private isChecked;
1316
+ private isCheckedWild;
1317
+ }
1318
+ interface ManywaysWinTypeOpts extends WinTypeOpts {
1319
+ }
1320
+ interface ManywaysWinCombination extends WinCombination {
1321
+ ways: number;
1261
1322
  }
1262
1323
 
1263
1324
  /**
@@ -1292,7 +1353,7 @@ declare class GeneratedReelSet extends ReelSet {
1292
1353
  * Checks if a symbol can be placed at the target index without violating spacing rules.
1293
1354
  */
1294
1355
  private violatesSpacing;
1295
- generateReels({ gameConfig: config }: Simulation): void;
1356
+ generateReels(config: GameConfig): this;
1296
1357
  }
1297
1358
  interface GeneratedReelSetOptions extends ReelSetOptions {
1298
1359
  /**
@@ -1406,7 +1467,7 @@ declare class StaticReelSet extends ReelSet {
1406
1467
  private _strReels;
1407
1468
  constructor(opts: StaticReelSetOptions);
1408
1469
  private validateConfig;
1409
- generateReels({ gameConfig: config }: Simulation): void;
1470
+ generateReels(config: GameConfig): this;
1410
1471
  }
1411
1472
  interface StaticReelSetOptions extends ReelSetOptions {
1412
1473
  reels?: string[][];
@@ -1431,6 +1492,14 @@ declare class StandaloneBoard {
1431
1492
  getBoardReels(): Reels;
1432
1493
  getPaddingTop(): Reels;
1433
1494
  getPaddingBottom(): Reels;
1495
+ /**
1496
+ * Gets the symbol at the specified reel and row index.
1497
+ */
1498
+ getSymbol(reelIndex: number, rowIndex: number): GameSymbol | undefined;
1499
+ /**
1500
+ * Sets the symbol at the specified reel and row index.
1501
+ */
1502
+ setSymbol(reelIndex: number, rowIndex: number, symbol: GameSymbol): void;
1434
1503
  private resetReels;
1435
1504
  /**
1436
1505
  * Sets the anticipation value for a specific reel.
@@ -1477,7 +1546,11 @@ declare class StandaloneBoard {
1477
1546
  /**
1478
1547
  * Draws a board using specified reel stops.
1479
1548
  */
1480
- drawBoardWithForcedStops(reels: Reels, forcedStops: Record<string, number>): void;
1549
+ drawBoardWithForcedStops(opts: {
1550
+ reels: Reels;
1551
+ forcedStops: Record<string, number>;
1552
+ randomOffset?: boolean;
1553
+ }): void;
1481
1554
  /**
1482
1555
  * Draws a board using random reel stops.
1483
1556
  */
package/dist/index.d.ts CHANGED
@@ -328,6 +328,10 @@ declare class GameSymbol {
328
328
  * Compares this symbol to another symbol or a set of properties.
329
329
  */
330
330
  compare(symbolOrProperties?: GameSymbol | Record<string, any>): boolean;
331
+ /**
332
+ * Creates a clone of this GameSymbol.
333
+ */
334
+ clone(): GameSymbol;
331
335
  }
332
336
  interface GameSymbolOpts {
333
337
  /**
@@ -370,6 +374,14 @@ declare class BoardService<TGameModes extends AnyGameModes = AnyGameModes, TSymb
370
374
  getPaddingTop(): Reels;
371
375
  getPaddingBottom(): Reels;
372
376
  getAnticipation(): boolean[];
377
+ /**
378
+ * Gets the symbol at the specified reel and row index.
379
+ */
380
+ getSymbol(reelIndex: number, rowIndex: number): GameSymbol | undefined;
381
+ /**
382
+ * Sets the symbol at the specified reel and row index.
383
+ */
384
+ setSymbol(reelIndex: number, rowIndex: number, symbol: GameSymbol): void;
373
385
  private resetReels;
374
386
  /**
375
387
  * Sets the anticipation value for a specific reel.
@@ -416,7 +428,11 @@ declare class BoardService<TGameModes extends AnyGameModes = AnyGameModes, TSymb
416
428
  /**
417
429
  * Draws a board using specified reel stops.
418
430
  */
419
- drawBoardWithForcedStops(reels: Reels, forcedStops: Record<string, number>): void;
431
+ drawBoardWithForcedStops(opts: {
432
+ reels: Reels;
433
+ forcedStops: Record<string, number>;
434
+ randomOffset?: boolean;
435
+ }): void;
420
436
  /**
421
437
  * Draws a board using random reel stops.
422
438
  */
@@ -597,7 +613,7 @@ declare class ReelSet {
597
613
  reels: Reels;
598
614
  protected rng: RandomNumberGenerator;
599
615
  constructor(opts: ReelSetOptions);
600
- generateReels(simulation: Simulation): void;
616
+ generateReels(config: GameConfig): ReelSet;
601
617
  /**
602
618
  * Reads a reelset CSV file and returns the reels as arrays of GameSymbols.
603
619
  */
@@ -675,6 +691,11 @@ interface GameModeOpts {
675
691
 
676
692
  declare class GameService<TGameModes extends AnyGameModes = AnyGameModes, TSymbols extends AnySymbols = AnySymbols, TUserState extends AnyUserData = AnyUserData> extends AbstractService {
677
693
  constructor(ctx: () => GameContext<TGameModes, TSymbols, TUserState>);
694
+ /**
695
+ * Intended for internal use only.\
696
+ * Generates reels for all reel sets in the game configuration.
697
+ */
698
+ _generateReels(): void;
678
699
  /**
679
700
  * Retrieves a reel set by its ID within a specific game mode.
680
701
  */
@@ -1171,6 +1192,7 @@ declare class WinType {
1171
1192
  winCombinations: WinCombination[];
1172
1193
  };
1173
1194
  protected isWild(symbol: GameSymbol): boolean;
1195
+ protected getSymbolPayout(symbol: GameSymbol, count: number): number;
1174
1196
  }
1175
1197
  interface WinTypeOpts {
1176
1198
  /**
@@ -1198,6 +1220,7 @@ interface WinTypeOpts {
1198
1220
  type WinCombination = {
1199
1221
  payout: number;
1200
1222
  kind: number;
1223
+ baseSymbol: GameSymbol;
1201
1224
  symbols: Array<{
1202
1225
  symbol: GameSymbol;
1203
1226
  isWild: boolean;
@@ -1226,6 +1249,7 @@ declare class LinesWinType extends WinType {
1226
1249
  * Retrieve the results using `getWins()` after.
1227
1250
  */
1228
1251
  evaluateWins(board: Reels): this;
1252
+ private getLinePayout;
1229
1253
  }
1230
1254
  interface LinesWinTypeOpts extends WinTypeOpts {
1231
1255
  /**
@@ -1244,20 +1268,57 @@ interface LinesWinTypeOpts extends WinTypeOpts {
1244
1268
  }
1245
1269
  interface LineWinCombination extends WinCombination {
1246
1270
  lineNumber: number;
1247
- symbol: GameSymbol;
1248
- winType: "pure-wild" | "substituted";
1249
- substitutedBaseSymbol: GameSymbol | null;
1250
- stats: {
1251
- wildCount: number;
1252
- nonWildCount: number;
1253
- leadingWilds: number;
1254
- };
1255
1271
  }
1256
1272
 
1257
1273
  declare class ClusterWinType extends WinType {
1274
+ protected winCombinations: ClusterWinCombination[];
1275
+ getWins: () => {
1276
+ payout: number;
1277
+ winCombinations: ClusterWinCombination[];
1278
+ };
1279
+ private _checked;
1280
+ private _checkedWilds;
1281
+ private _currentBoard;
1282
+ constructor(opts: ClusterWinTypeOpts);
1283
+ private validateConfig;
1284
+ /**
1285
+ * Calculates wins based on symbol cluster size and provided board state.\
1286
+ * Retrieve the results using `getWins()` after.
1287
+ */
1288
+ evaluateWins(board: Reels): this;
1289
+ private getNeighbors;
1290
+ private evaluateCluster;
1291
+ private isChecked;
1292
+ private isCheckedWild;
1293
+ }
1294
+ interface ClusterWinTypeOpts extends WinTypeOpts {
1295
+ }
1296
+ interface ClusterWinCombination extends WinCombination {
1258
1297
  }
1259
1298
 
1260
1299
  declare class ManywaysWinType extends WinType {
1300
+ protected winCombinations: ManywaysWinCombination[];
1301
+ getWins: () => {
1302
+ payout: number;
1303
+ winCombinations: ManywaysWinCombination[];
1304
+ };
1305
+ private _checked;
1306
+ private _checkedWilds;
1307
+ constructor(opts: ManywaysWinTypeOpts);
1308
+ private validateConfig;
1309
+ /**
1310
+ * Calculates wins based on the defined paylines and provided board state.\
1311
+ * Retrieve the results using `getWins()` after.
1312
+ */
1313
+ evaluateWins(board: Reels): this;
1314
+ private getWayLength;
1315
+ private isChecked;
1316
+ private isCheckedWild;
1317
+ }
1318
+ interface ManywaysWinTypeOpts extends WinTypeOpts {
1319
+ }
1320
+ interface ManywaysWinCombination extends WinCombination {
1321
+ ways: number;
1261
1322
  }
1262
1323
 
1263
1324
  /**
@@ -1292,7 +1353,7 @@ declare class GeneratedReelSet extends ReelSet {
1292
1353
  * Checks if a symbol can be placed at the target index without violating spacing rules.
1293
1354
  */
1294
1355
  private violatesSpacing;
1295
- generateReels({ gameConfig: config }: Simulation): void;
1356
+ generateReels(config: GameConfig): this;
1296
1357
  }
1297
1358
  interface GeneratedReelSetOptions extends ReelSetOptions {
1298
1359
  /**
@@ -1406,7 +1467,7 @@ declare class StaticReelSet extends ReelSet {
1406
1467
  private _strReels;
1407
1468
  constructor(opts: StaticReelSetOptions);
1408
1469
  private validateConfig;
1409
- generateReels({ gameConfig: config }: Simulation): void;
1470
+ generateReels(config: GameConfig): this;
1410
1471
  }
1411
1472
  interface StaticReelSetOptions extends ReelSetOptions {
1412
1473
  reels?: string[][];
@@ -1431,6 +1492,14 @@ declare class StandaloneBoard {
1431
1492
  getBoardReels(): Reels;
1432
1493
  getPaddingTop(): Reels;
1433
1494
  getPaddingBottom(): Reels;
1495
+ /**
1496
+ * Gets the symbol at the specified reel and row index.
1497
+ */
1498
+ getSymbol(reelIndex: number, rowIndex: number): GameSymbol | undefined;
1499
+ /**
1500
+ * Sets the symbol at the specified reel and row index.
1501
+ */
1502
+ setSymbol(reelIndex: number, rowIndex: number, symbol: GameSymbol): void;
1434
1503
  private resetReels;
1435
1504
  /**
1436
1505
  * Sets the anticipation value for a specific reel.
@@ -1477,7 +1546,11 @@ declare class StandaloneBoard {
1477
1546
  /**
1478
1547
  * Draws a board using specified reel stops.
1479
1548
  */
1480
- drawBoardWithForcedStops(reels: Reels, forcedStops: Record<string, number>): void;
1549
+ drawBoardWithForcedStops(opts: {
1550
+ reels: Reels;
1551
+ forcedStops: Record<string, number>;
1552
+ randomOffset?: boolean;
1553
+ }): void;
1481
1554
  /**
1482
1555
  * Draws a board using random reel stops.
1483
1556
  */