shufflecom-calculations 4.2.0 → 4.2.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.
Files changed (62) hide show
  1. package/lib/games/coinflip/coinflip-classic-progressive.d.ts +1 -1
  2. package/lib/games/coinflip/coinflip-classic.d.ts +1 -1
  3. package/lib/games/coinflip/coinflip-rules.d.ts +1 -1
  4. package/lib/games/coinflip/coinflip-target.d.ts +1 -1
  5. package/lib/games/floor-is-lava/floor-is-lava-board.d.ts +8 -0
  6. package/lib/games/floor-is-lava/floor-is-lava-board.js +37 -0
  7. package/lib/games/floor-is-lava/floor-is-lava-board.js.map +1 -0
  8. package/lib/games/floor-is-lava/floor-is-lava-rules.d.ts +69 -0
  9. package/lib/games/floor-is-lava/floor-is-lava-rules.js +133 -0
  10. package/lib/games/floor-is-lava/floor-is-lava-rules.js.map +1 -0
  11. package/lib/games/floor-is-lava/floor-is-lava.d.ts +34 -0
  12. package/lib/games/floor-is-lava/floor-is-lava.js +106 -0
  13. package/lib/games/floor-is-lava/floor-is-lava.js.map +1 -0
  14. package/lib/games/rng/fixed-rng.js.map +1 -0
  15. package/lib/games/rng/random-number-generator.interface.js.map +1 -0
  16. package/lib/games/rng/shuffle-random-number-generator.d.ts +21 -0
  17. package/lib/games/rng/shuffle-random-number-generator.js +76 -0
  18. package/lib/games/rng/shuffle-random-number-generator.js.map +1 -0
  19. package/lib/games/rng/true-random-rng.js.map +1 -0
  20. package/lib/index.d.ts +7 -2
  21. package/lib/index.js +7 -2
  22. package/lib/index.js.map +1 -1
  23. package/lib/tsconfig.tsbuildinfo +1 -1
  24. package/package.json +2 -2
  25. package/src/games/coinflip/coinflip-classic-progressive.spec.ts +14 -3
  26. package/src/games/coinflip/coinflip-classic-progressive.ts +1 -1
  27. package/src/games/coinflip/coinflip-classic.spec.ts +1 -1
  28. package/src/games/coinflip/coinflip-classic.ts +1 -1
  29. package/src/games/coinflip/coinflip-rules.spec.ts +1 -1
  30. package/src/games/coinflip/coinflip-rules.ts +1 -1
  31. package/src/games/coinflip/coinflip-target.spec.ts +1 -1
  32. package/src/games/coinflip/coinflip-target.ts +1 -1
  33. package/src/games/floor-is-lava/floor-is-lava-board.spec.ts +61 -0
  34. package/src/games/floor-is-lava/floor-is-lava-board.ts +41 -0
  35. package/src/games/floor-is-lava/floor-is-lava-rules.spec.ts +316 -0
  36. package/src/games/floor-is-lava/floor-is-lava-rules.ts +217 -0
  37. package/src/games/floor-is-lava/floor-is-lava.spec.ts +455 -0
  38. package/src/games/floor-is-lava/floor-is-lava.ts +138 -0
  39. package/src/games/rng/shuffle-random-number-generator.ts +100 -0
  40. package/src/index.ts +7 -2
  41. package/lib/games/fixed-rng.js.map +0 -1
  42. package/lib/games/floor-is-lava-rules.d.ts +0 -52
  43. package/lib/games/floor-is-lava-rules.js +0 -82
  44. package/lib/games/floor-is-lava-rules.js.map +0 -1
  45. package/lib/games/floor-is-lava.d.ts +0 -56
  46. package/lib/games/floor-is-lava.js +0 -134
  47. package/lib/games/floor-is-lava.js.map +0 -1
  48. package/lib/games/random-number-generator.interface.js.map +0 -1
  49. package/lib/games/true-random-rng.js.map +0 -1
  50. package/src/games/floor-is-lava-rules.spec.ts +0 -126
  51. package/src/games/floor-is-lava-rules.ts +0 -125
  52. package/src/games/floor-is-lava.spec.ts +0 -502
  53. package/src/games/floor-is-lava.ts +0 -184
  54. /package/lib/games/{fixed-rng.d.ts → rng/fixed-rng.d.ts} +0 -0
  55. /package/lib/games/{fixed-rng.js → rng/fixed-rng.js} +0 -0
  56. /package/lib/games/{random-number-generator.interface.d.ts → rng/random-number-generator.interface.d.ts} +0 -0
  57. /package/lib/games/{random-number-generator.interface.js → rng/random-number-generator.interface.js} +0 -0
  58. /package/lib/games/{true-random-rng.d.ts → rng/true-random-rng.d.ts} +0 -0
  59. /package/lib/games/{true-random-rng.js → rng/true-random-rng.js} +0 -0
  60. /package/src/games/{fixed-rng.ts → rng/fixed-rng.ts} +0 -0
  61. /package/src/games/{random-number-generator.interface.ts → rng/random-number-generator.interface.ts} +0 -0
  62. /package/src/games/{true-random-rng.ts → rng/true-random-rng.ts} +0 -0
@@ -0,0 +1,138 @@
1
+ import BigNumber from 'bignumber.js';
2
+ import { FloorIsLavaBoard } from './floor-is-lava-board';
3
+ import {
4
+ DIFFICULTY_LEVEL_MAP,
5
+ FloorIsLavaActionPhase,
6
+ FloorIsLavaCashoutAction,
7
+ FloorIsLavaDifficulty,
8
+ FloorIsLavaGameAction,
9
+ FloorIsLavaGameStatus,
10
+ FloorIsLavaInProgressState,
11
+ FloorIsLavaMultipliers,
12
+ FloorIsLavaPickAction,
13
+ FloorIsLavaRules,
14
+ FloorIsLavaStartAction,
15
+ LEVELS_PER_DIFFICULTY,
16
+ } from './floor-is-lava-rules';
17
+
18
+ export type FloorIsLavaNextError = 'tile-already-dropped' | 'no-tiles-remaining' | 'invalid-tile';
19
+
20
+ export type FloorIsLavaNextResult =
21
+ | { ok: true; multiplier: BigNumber; gameAction: FloorIsLavaPickAction; tilesDroppedInCurrentLevel: number }
22
+ | { ok: false; error: FloorIsLavaNextError };
23
+
24
+ export type FloorIsLavaCashoutError = 'no-tiles-selected';
25
+
26
+ export type FloorIsLavaCashoutResult =
27
+ | { ok: true; multiplier: BigNumber; gameAction: FloorIsLavaCashoutAction; tilesDroppedInCurrentLevel: number }
28
+ | { ok: false; error: FloorIsLavaCashoutError };
29
+
30
+ export class FloorIsLava {
31
+ private constructor(private readonly state: FloorIsLavaInProgressState) {}
32
+
33
+ public static createAction(difficulty: FloorIsLavaDifficulty): FloorIsLavaStartAction {
34
+ return { phase: FloorIsLavaActionPhase.START, difficulty };
35
+ }
36
+
37
+ public static fromActions(gameActions: FloorIsLavaGameAction[]): FloorIsLava {
38
+ const state = FloorIsLavaRules.reconstructState(gameActions);
39
+ if (state.status !== 'in-progress') {
40
+ throw new Error(`FloorIsLava - cannot resume a game that has already ended (status: ${state.status})`);
41
+ }
42
+ return new FloorIsLava(state);
43
+ }
44
+
45
+ public getDetailedState(): FloorIsLavaInProgressState {
46
+ return this.state;
47
+ }
48
+
49
+ public getMultipliers(edge: number): FloorIsLavaMultipliers {
50
+ return FloorIsLavaRules.multipliers(this.state, edge);
51
+ }
52
+
53
+ public canCashout(): boolean {
54
+ return this.state.currentLevel > 0 || this.state.roundsSurvivedInCurrentLevel > 0;
55
+ }
56
+
57
+ public next(selectedTile: number, board: FloorIsLavaBoard, edge: number): FloorIsLavaNextResult {
58
+ if (!FloorIsLavaRules.isValidTile(selectedTile)) {
59
+ return { ok: false, error: 'invalid-tile' };
60
+ }
61
+
62
+ const { difficulty, currentLevel, roundsSurvivedInCurrentLevel, droppedTilesByLevel } = this.state;
63
+ const { dropsPerRound, roundsPerLevel } = DIFFICULTY_LEVEL_MAP[difficulty];
64
+
65
+ if (roundsSurvivedInCurrentLevel >= roundsPerLevel) {
66
+ return { ok: false, error: 'no-tiles-remaining' };
67
+ }
68
+
69
+ if (droppedTilesByLevel[currentLevel].includes(selectedTile)) {
70
+ return { ok: false, error: 'tile-already-dropped' };
71
+ }
72
+
73
+ const droppedTiles = board.tilesDroppedInRound(currentLevel, dropsPerRound, roundsSurvivedInCurrentLevel);
74
+ const isLoss = droppedTiles.includes(selectedTile);
75
+ const tilesDroppedInCurrentLevel = (roundsSurvivedInCurrentLevel + 1) * dropsPerRound;
76
+
77
+ if (isLoss) {
78
+ return {
79
+ ok: true,
80
+ multiplier: BigNumber(0),
81
+ gameAction: {
82
+ phase: FloorIsLavaActionPhase.PICK,
83
+ level: currentLevel,
84
+ selectedTile,
85
+ droppedTiles,
86
+ gameStatus: FloorIsLavaGameStatus.LOST,
87
+ multiplier: BigNumber(0),
88
+ },
89
+ tilesDroppedInCurrentLevel,
90
+ };
91
+ }
92
+
93
+ const roundsSurvivedAfter = roundsSurvivedInCurrentLevel + 1;
94
+ const isLevelCleared = roundsSurvivedAfter >= roundsPerLevel;
95
+ const isFinalLevel = currentLevel === LEVELS_PER_DIFFICULTY - 1;
96
+ const { nextMultiplier } = FloorIsLavaRules.multipliers(this.state, edge);
97
+
98
+ let gameStatus: FloorIsLavaGameStatus;
99
+ if (!isLevelCleared) {
100
+ gameStatus = FloorIsLavaGameStatus.IN_PROGRESS;
101
+ } else if (isFinalLevel) {
102
+ gameStatus = FloorIsLavaGameStatus.COMPLETED;
103
+ } else {
104
+ gameStatus = FloorIsLavaGameStatus.LEVEL_COMPLETE;
105
+ }
106
+
107
+ return {
108
+ ok: true,
109
+ multiplier: nextMultiplier,
110
+ gameAction: {
111
+ phase: FloorIsLavaActionPhase.PICK,
112
+ level: currentLevel,
113
+ selectedTile,
114
+ droppedTiles,
115
+ gameStatus,
116
+ multiplier: nextMultiplier,
117
+ },
118
+ tilesDroppedInCurrentLevel,
119
+ };
120
+ }
121
+
122
+ public cashout(edge: number): FloorIsLavaCashoutResult {
123
+ if (!this.canCashout()) {
124
+ return { ok: false, error: 'no-tiles-selected' };
125
+ }
126
+
127
+ const { currentLevel, roundsSurvivedInCurrentLevel, difficulty } = this.state;
128
+ const { dropsPerRound } = DIFFICULTY_LEVEL_MAP[difficulty];
129
+ const { currentMultiplier } = FloorIsLavaRules.multipliers(this.state, edge);
130
+
131
+ return {
132
+ ok: true,
133
+ multiplier: currentMultiplier,
134
+ gameAction: { phase: FloorIsLavaActionPhase.CASHOUT, level: currentLevel, multiplier: currentMultiplier },
135
+ tilesDroppedInCurrentLevel: roundsSurvivedInCurrentLevel * dropsPerRound,
136
+ };
137
+ }
138
+ }
@@ -0,0 +1,100 @@
1
+ import crypto from 'crypto';
2
+ import BigNumber from 'bignumber.js';
3
+ import { hexToBytes } from '../../utils/hex-to-bytes';
4
+ import { RandomNumberGenerator } from './random-number-generator.interface';
5
+
6
+ const BYTES_PER_RANDOM_NUMBER = 4;
7
+ const NUMBERS_PER_HASH = 8;
8
+ const BYTE_RANGE = BigNumber(256);
9
+
10
+ export class ShuffleRandomNumberGenerator implements RandomNumberGenerator {
11
+ constructor(
12
+ private readonly serverSeed: string,
13
+ private readonly clientSeed: string,
14
+ private readonly nonce: number,
15
+ ) {}
16
+
17
+ public getRandomIntsWithReplacement({
18
+ min,
19
+ max,
20
+ count,
21
+ }: {
22
+ min: number;
23
+ max: number;
24
+ count: number;
25
+ }): number[] {
26
+ const range = max - min + 1;
27
+ return this.calculateFractions(count).map(fraction => min + this.scale(fraction, range));
28
+ }
29
+
30
+ public getRandomIntsWithoutReplacement({
31
+ min,
32
+ max,
33
+ count,
34
+ }: {
35
+ min: number;
36
+ max: number;
37
+ count: number;
38
+ }): number[] {
39
+ if (count > max - min + 1) {
40
+ throw new Error(`ShuffleRandomNumberGenerator - cannot draw ${count} distinct values from range [${min}, ${max}]`);
41
+ }
42
+
43
+ const fractions = this.calculateFractions(count);
44
+ const pool = Array.from({ length: max - min + 1 }, (_, i) => min + i);
45
+ const result: number[] = [];
46
+
47
+ for (const fraction of fractions) {
48
+ const index = this.scale(fraction, pool.length);
49
+ const [value] = pool.splice(index, 1);
50
+ if (value === undefined) {
51
+ throw new Error('ShuffleRandomNumberGenerator - drew an index from an empty pool');
52
+ }
53
+ result.push(value);
54
+ }
55
+
56
+ return result;
57
+ }
58
+
59
+ private calculateFractions(count: number): BigNumber[] {
60
+ const rounds = Math.ceil(count / NUMBERS_PER_HASH);
61
+ const fractions: BigNumber[] = [];
62
+
63
+ for (let round = 0; round < rounds; round++) {
64
+ const bytes = hexToBytes(this.hashRound(round));
65
+ for (let position = 0; position < NUMBERS_PER_HASH && fractions.length < count; position++) {
66
+ fractions.push(this.calculateFractionFromBytes(bytes, position));
67
+ }
68
+ }
69
+
70
+ return fractions;
71
+ }
72
+
73
+ private scale(fraction: BigNumber, size: number): number {
74
+ return fraction.multipliedBy(size).integerValue(BigNumber.ROUND_FLOOR).toNumber();
75
+ }
76
+
77
+ private hashRound(round: number): string {
78
+ const hmac = crypto.createHmac('sha256', this.serverSeed);
79
+ hmac.update(`${this.clientSeed}:${this.nonce}:${round}`);
80
+ return hmac.digest('hex');
81
+ }
82
+
83
+ private calculateFractionFromBytes(bytes: Uint8Array, position: number): BigNumber {
84
+ const start = BYTES_PER_RANDOM_NUMBER * position;
85
+
86
+ if (start + BYTES_PER_RANDOM_NUMBER > bytes.length) {
87
+ throw new Error('ShuffleRandomNumberGenerator - not enough bytes for the requested position');
88
+ }
89
+
90
+ let fraction = BigNumber(0);
91
+ for (let offset = 0; offset < BYTES_PER_RANDOM_NUMBER; offset++) {
92
+ const byte = bytes[start + offset];
93
+ if (byte === undefined) {
94
+ throw new Error('ShuffleRandomNumberGenerator - not enough bytes for the requested position');
95
+ }
96
+ fraction = fraction.plus(BigNumber(byte).dividedBy(BYTE_RANGE.pow(offset + 1)));
97
+ }
98
+ return fraction;
99
+ }
100
+ }
package/src/index.ts CHANGED
@@ -51,5 +51,10 @@ export * from './games/coinflip/coinflip-rules';
51
51
  export * from './games/coinflip/coinflip-classic';
52
52
  export * from './games/coinflip/coinflip-classic-progressive';
53
53
  export * from './games/coinflip/coinflip-target';
54
- export * from './games/floor-is-lava';
55
- export * from './games/floor-is-lava-rules';
54
+ export * from './games/floor-is-lava/floor-is-lava';
55
+ export * from './games/floor-is-lava/floor-is-lava-rules';
56
+ export * from './games/floor-is-lava/floor-is-lava-board';
57
+ export * from './games/rng/shuffle-random-number-generator';
58
+ export * from './games/rng/random-number-generator.interface';
59
+ export * from './games/rng/true-random-rng';
60
+ export * from './games/rng/fixed-rng';
@@ -1 +0,0 @@
1
- {"version":3,"file":"fixed-rng.js","sourceRoot":"","sources":["../../src/games/fixed-rng.ts"],"names":[],"mappings":";;;AAEA,MAAa,gBAAgB;IAC3B,YAA6B,MAAgB;QAAhB,WAAM,GAAN,MAAM,CAAU;IAAG,CAAC;IAEjD,4BAA4B,CAAC,EAAE,KAAK,EAA+C;QACjF,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;QAE3C,IAAI,MAAM,CAAC,MAAM,KAAK,KAAK,EAAE,CAAC;YAC5B,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;QACjE,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,+BAA+B,CAAC,EAAE,KAAK,EAA+C;QACpF,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;QAE3C,IAAI,MAAM,CAAC,MAAM,KAAK,KAAK,EAAE,CAAC;YAC5B,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;QACjE,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAtBD,4CAsBC"}
@@ -1,52 +0,0 @@
1
- import BigNumber from 'bignumber.js';
2
- import { RandomNumberGenerator } from './random-number-generator.interface';
3
- export declare const BOARD_SIZE = 49;
4
- export declare const DROPPABLE_TILES: number;
5
- export declare enum FloorIsLavaDifficulty {
6
- EASY = "EASY",
7
- MEDIUM = "MEDIUM",
8
- HARD = "HARD",
9
- TOXIC = "TOXIC"
10
- }
11
- export declare const DIFFICULTY_DROP_MAP: Readonly<Record<FloorIsLavaDifficulty, number>>;
12
- export declare const MAX_ROUNDS: number;
13
- export declare enum FloorIsLavaActionPhase {
14
- START = "START",
15
- SUCCESSFUL_PICK = "SUCCESSFUL_PICK",
16
- BUST_PICK = "BUST_PICK",
17
- CASHOUT = "CASHOUT"
18
- }
19
- export interface FloorIsLavaStartAction {
20
- phase: FloorIsLavaActionPhase.START;
21
- difficulty: FloorIsLavaDifficulty;
22
- }
23
- export interface FloorIsLavaSuccessfulPickAction {
24
- phase: FloorIsLavaActionPhase.SUCCESSFUL_PICK;
25
- selectedTile: number;
26
- droppedTiles: number[];
27
- multiplier: BigNumber;
28
- }
29
- export interface FloorIsLavaBustPickAction {
30
- phase: FloorIsLavaActionPhase.BUST_PICK;
31
- selectedTile: number;
32
- droppedTiles: number[];
33
- lastSurvivingTile: number;
34
- }
35
- export interface FloorIsLavaCashoutAction {
36
- phase: FloorIsLavaActionPhase.CASHOUT;
37
- multiplier: BigNumber;
38
- lastSurvivingTile: number;
39
- }
40
- export type FloorIsLavaGameAction = FloorIsLavaStartAction | FloorIsLavaSuccessfulPickAction | FloorIsLavaBustPickAction | FloorIsLavaCashoutAction;
41
- export declare class FloorIsLavaRules {
42
- static maxRounds(difficulty: FloorIsLavaDifficulty): number;
43
- static tilesRemaining(roundsSurvived: number, dropsPerRound: number): number;
44
- static isValidTile(tile: number): boolean;
45
- static multiplier(roundsSurvived: number, dropsPerRound: number, edge: number): BigNumber;
46
- static lastSurvivingTile(generator: RandomNumberGenerator): number;
47
- static getRoundResults(generator: RandomNumberGenerator, dropsPerRound: number, numRounds: number): number[][];
48
- static reconstructRounds(gameActions: FloorIsLavaGameAction[]): {
49
- roundsSurvived: number;
50
- dropsPerRound: number;
51
- };
52
- }
@@ -1,82 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FloorIsLavaRules = exports.FloorIsLavaActionPhase = exports.MAX_ROUNDS = exports.DIFFICULTY_DROP_MAP = exports.FloorIsLavaDifficulty = exports.DROPPABLE_TILES = exports.BOARD_SIZE = void 0;
4
- const edge_1 = require("../utils/edge");
5
- exports.BOARD_SIZE = 49;
6
- exports.DROPPABLE_TILES = exports.BOARD_SIZE - 1;
7
- var FloorIsLavaDifficulty;
8
- (function (FloorIsLavaDifficulty) {
9
- FloorIsLavaDifficulty["EASY"] = "EASY";
10
- FloorIsLavaDifficulty["MEDIUM"] = "MEDIUM";
11
- FloorIsLavaDifficulty["HARD"] = "HARD";
12
- FloorIsLavaDifficulty["TOXIC"] = "TOXIC";
13
- })(FloorIsLavaDifficulty || (exports.FloorIsLavaDifficulty = FloorIsLavaDifficulty = {}));
14
- exports.DIFFICULTY_DROP_MAP = {
15
- [FloorIsLavaDifficulty.EASY]: 4,
16
- [FloorIsLavaDifficulty.MEDIUM]: 6,
17
- [FloorIsLavaDifficulty.HARD]: 8,
18
- [FloorIsLavaDifficulty.TOXIC]: 48,
19
- };
20
- exports.MAX_ROUNDS = exports.DROPPABLE_TILES / Math.min(...Object.values(exports.DIFFICULTY_DROP_MAP));
21
- var FloorIsLavaActionPhase;
22
- (function (FloorIsLavaActionPhase) {
23
- FloorIsLavaActionPhase["START"] = "START";
24
- FloorIsLavaActionPhase["SUCCESSFUL_PICK"] = "SUCCESSFUL_PICK";
25
- FloorIsLavaActionPhase["BUST_PICK"] = "BUST_PICK";
26
- FloorIsLavaActionPhase["CASHOUT"] = "CASHOUT";
27
- })(FloorIsLavaActionPhase || (exports.FloorIsLavaActionPhase = FloorIsLavaActionPhase = {}));
28
- class FloorIsLavaRules {
29
- static maxRounds(difficulty) {
30
- return exports.DROPPABLE_TILES / exports.DIFFICULTY_DROP_MAP[difficulty];
31
- }
32
- static tilesRemaining(roundsSurvived, dropsPerRound) {
33
- return exports.BOARD_SIZE - roundsSurvived * dropsPerRound;
34
- }
35
- static isValidTile(tile) {
36
- return Number.isInteger(tile) && tile >= 0 && tile <= exports.BOARD_SIZE - 1;
37
- }
38
- static multiplier(roundsSurvived, dropsPerRound, edge) {
39
- return (0, edge_1.calculateEdgeMultiplier)(edge).multipliedBy(exports.BOARD_SIZE).dividedBy(FloorIsLavaRules.tilesRemaining(roundsSurvived, dropsPerRound));
40
- }
41
- static lastSurvivingTile(generator) {
42
- const dropOrder = generator.getRandomIntsWithoutReplacement({ min: 0, max: exports.BOARD_SIZE - 1, count: exports.BOARD_SIZE });
43
- return dropOrder[dropOrder.length - 1];
44
- }
45
- static getRoundResults(generator, dropsPerRound, numRounds) {
46
- const dropSequence = generator.getRandomIntsWithoutReplacement({ min: 0, max: exports.BOARD_SIZE - 1, count: numRounds * dropsPerRound });
47
- const rounds = [];
48
- for (let round = 0; round < numRounds; round++) {
49
- rounds.push(dropSequence.slice(round * dropsPerRound, (round + 1) * dropsPerRound));
50
- }
51
- return rounds;
52
- }
53
- static reconstructRounds(gameActions) {
54
- const first = gameActions[0];
55
- if (!first || first.phase !== FloorIsLavaActionPhase.START) {
56
- throw new Error('First action must be START');
57
- }
58
- const dropsPerRound = exports.DIFFICULTY_DROP_MAP[first.difficulty];
59
- const maxRounds = FloorIsLavaRules.maxRounds(first.difficulty);
60
- let roundsSurvived = 0;
61
- for (let i = 1; i < gameActions.length; i++) {
62
- const action = gameActions[i];
63
- switch (action.phase) {
64
- case FloorIsLavaActionPhase.START:
65
- throw new Error('START action can only appear as the first action');
66
- case FloorIsLavaActionPhase.SUCCESSFUL_PICK:
67
- roundsSurvived++;
68
- if (roundsSurvived > maxRounds) {
69
- throw new Error(`Reconstructed rounds (${roundsSurvived}) exceeds max rounds (${maxRounds})`);
70
- }
71
- break;
72
- case FloorIsLavaActionPhase.BUST_PICK:
73
- throw new Error('An active game cannot have a BUST_PICK action');
74
- case FloorIsLavaActionPhase.CASHOUT:
75
- throw new Error('An active game cannot have a CASHOUT action');
76
- }
77
- }
78
- return { roundsSurvived, dropsPerRound };
79
- }
80
- }
81
- exports.FloorIsLavaRules = FloorIsLavaRules;
82
- //# sourceMappingURL=floor-is-lava-rules.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"floor-is-lava-rules.js","sourceRoot":"","sources":["../../src/games/floor-is-lava-rules.ts"],"names":[],"mappings":";;;AACA,wCAAwD;AAG3C,QAAA,UAAU,GAAG,EAAE,CAAC;AAChB,QAAA,eAAe,GAAG,kBAAU,GAAG,CAAC,CAAC;AAE9C,IAAY,qBAKX;AALD,WAAY,qBAAqB;IAC/B,sCAAa,CAAA;IACb,0CAAiB,CAAA;IACjB,sCAAa,CAAA;IACb,wCAAe,CAAA;AACjB,CAAC,EALW,qBAAqB,qCAArB,qBAAqB,QAKhC;AAEY,QAAA,mBAAmB,GAAoD;IAClF,CAAC,qBAAqB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC/B,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,CAAC;IACjC,CAAC,qBAAqB,CAAC,IAAI,CAAC,EAAE,CAAC;IAC/B,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AK;oBAC/B,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;gBACtE,KAAK,sBAAsB,CAAC,eAAe;oBACzC,cAAc,EAAE,CAAC;oBACjB,IAAI,cAAc,GAAG,SAAS,EAAE,CAAC;wBAC/B,MAAM,IAAI,KAAK,CAAC,yBAAyB,cAAc,yBAAyB,SAAS,GAAG,CAAC,CAAC;oBAChG,CAAC;oBACD,MAAM;gBACR,KAAK,sBAAsB,CAAC,SAAS;oBACnC,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;gBACnE,KAAK,sBAAsB,CAAC,OAAO;oBACjC,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;YACnE,CAAC;QACH,CAAC;QAED,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC;IAC3C,CAAC;CACF;AA/DD,4CA+DC"}
@@ -1,56 +0,0 @@
1
- import BigNumber from 'bignumber.js';
2
- import { FloorIsLavaBustPickAction, FloorIsLavaCashoutAction, FloorIsLavaDifficulty, FloorIsLavaGameAction, FloorIsLavaStartAction, FloorIsLavaSuccessfulPickAction } from './floor-is-lava-rules';
3
- import { RandomNumberGenerator } from './random-number-generator.interface';
4
- export * from './floor-is-lava-rules';
5
- export type FloorIsLavaNextError = 'tile-already-dropped' | 'no-tiles-remaining' | 'invalid-tile';
6
- export type FloorIsLavaNextResult = {
7
- ok: true;
8
- multiplier: BigNumber;
9
- gameAction: FloorIsLavaSuccessfulPickAction | FloorIsLavaBustPickAction;
10
- isLoss: boolean;
11
- isLastTile: boolean;
12
- } | {
13
- ok: false;
14
- error: FloorIsLavaNextError;
15
- };
16
- export type FloorIsLavaCashoutError = 'no-tiles-selected';
17
- export type FloorIsLavaCashoutResult = {
18
- ok: true;
19
- multiplier: BigNumber;
20
- gameAction: FloorIsLavaCashoutAction;
21
- } | {
22
- ok: false;
23
- error: FloorIsLavaCashoutError;
24
- };
25
- export declare enum FloorIsLavaAutoBetRoundOutcome {
26
- SURVIVED = "SURVIVED",
27
- LOST = "LOST",
28
- CASHED_OUT = "CASHED_OUT"
29
- }
30
- export interface FloorIsLavaAutoBetRoundResult {
31
- selectedTile: number;
32
- droppedTiles: number[];
33
- outcome: FloorIsLavaAutoBetRoundOutcome;
34
- }
35
- export type FloorIsLavaAutoBetError = 'invalid-selected-tiles-count' | 'invalid-tile';
36
- export type FloorIsLavaAutoBetResult = {
37
- ok: true;
38
- multiplier: BigNumber;
39
- results: FloorIsLavaAutoBetRoundResult[];
40
- survivedRounds: number;
41
- lastSurvivingTile: number;
42
- } | {
43
- ok: false;
44
- error: FloorIsLavaAutoBetError;
45
- };
46
- export declare class FloorIsLava {
47
- private readonly roundsSurvived;
48
- private readonly dropsPerRound;
49
- private constructor();
50
- static createAction(difficulty: FloorIsLavaDifficulty): FloorIsLavaStartAction;
51
- static fromActions(gameActions: FloorIsLavaGameAction[]): FloorIsLava;
52
- canCashout(): boolean;
53
- next(selectedTile: number, generator: RandomNumberGenerator, edge: number): FloorIsLavaNextResult;
54
- cashout(generator: RandomNumberGenerator, edge: number): FloorIsLavaCashoutResult;
55
- static autobet(difficulty: FloorIsLavaDifficulty, selectedTiles: number[], generator: RandomNumberGenerator, edge: number): FloorIsLavaAutoBetResult;
56
- }
@@ -1,134 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- var __importDefault = (this && this.__importDefault) || function (mod) {
17
- return (mod && mod.__esModule) ? mod : { "default": mod };
18
- };
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.FloorIsLava = exports.FloorIsLavaAutoBetRoundOutcome = void 0;
21
- const bignumber_js_1 = __importDefault(require("bignumber.js"));
22
- const floor_is_lava_rules_1 = require("./floor-is-lava-rules");
23
- __exportStar(require("./floor-is-lava-rules"), exports);
24
- var FloorIsLavaAutoBetRoundOutcome;
25
- (function (FloorIsLavaAutoBetRoundOutcome) {
26
- FloorIsLavaAutoBetRoundOutcome["SURVIVED"] = "SURVIVED";
27
- FloorIsLavaAutoBetRoundOutcome["LOST"] = "LOST";
28
- FloorIsLavaAutoBetRoundOutcome["CASHED_OUT"] = "CASHED_OUT";
29
- })(FloorIsLavaAutoBetRoundOutcome || (exports.FloorIsLavaAutoBetRoundOutcome = FloorIsLavaAutoBetRoundOutcome = {}));
30
- class FloorIsLava {
31
- constructor(roundsSurvived, dropsPerRound) {
32
- this.roundsSurvived = roundsSurvived;
33
- this.dropsPerRound = dropsPerRound;
34
- }
35
- static createAction(difficulty) {
36
- return { phase: floor_is_lava_rules_1.FloorIsLavaActionPhase.START, difficulty };
37
- }
38
- static fromActions(gameActions) {
39
- const { roundsSurvived, dropsPerRound } = floor_is_lava_rules_1.FloorIsLavaRules.reconstructRounds(gameActions);
40
- return new FloorIsLava(roundsSurvived, dropsPerRound);
41
- }
42
- canCashout() {
43
- return this.roundsSurvived > 0;
44
- }
45
- next(selectedTile, generator, edge) {
46
- if (!floor_is_lava_rules_1.FloorIsLavaRules.isValidTile(selectedTile)) {
47
- return { ok: false, error: 'invalid-tile' };
48
- }
49
- if (floor_is_lava_rules_1.FloorIsLavaRules.tilesRemaining(this.roundsSurvived, this.dropsPerRound) <= 1) {
50
- return { ok: false, error: 'no-tiles-remaining' };
51
- }
52
- const rounds = floor_is_lava_rules_1.FloorIsLavaRules.getRoundResults(generator, this.dropsPerRound, this.roundsSurvived + 1);
53
- const priorDrops = rounds.slice(0, this.roundsSurvived).flat();
54
- if (priorDrops.includes(selectedTile)) {
55
- return { ok: false, error: 'tile-already-dropped' };
56
- }
57
- const thisRoundDrops = rounds[this.roundsSurvived];
58
- const isLoss = thisRoundDrops.includes(selectedTile);
59
- const roundsSurvivedAfter = isLoss ? this.roundsSurvived : this.roundsSurvived + 1;
60
- const isLastTile = floor_is_lava_rules_1.FloorIsLavaRules.tilesRemaining(roundsSurvivedAfter, this.dropsPerRound) <= 1;
61
- const multiplier = isLoss ? (0, bignumber_js_1.default)(0) : floor_is_lava_rules_1.FloorIsLavaRules.multiplier(roundsSurvivedAfter, this.dropsPerRound, edge);
62
- const gameAction = isLoss
63
- ? {
64
- phase: floor_is_lava_rules_1.FloorIsLavaActionPhase.BUST_PICK,
65
- selectedTile,
66
- droppedTiles: thisRoundDrops,
67
- lastSurvivingTile: floor_is_lava_rules_1.FloorIsLavaRules.lastSurvivingTile(generator),
68
- }
69
- : { phase: floor_is_lava_rules_1.FloorIsLavaActionPhase.SUCCESSFUL_PICK, selectedTile, droppedTiles: thisRoundDrops, multiplier };
70
- return {
71
- ok: true,
72
- multiplier,
73
- gameAction,
74
- isLoss,
75
- isLastTile,
76
- };
77
- }
78
- cashout(generator, edge) {
79
- if (!this.canCashout()) {
80
- return { ok: false, error: 'no-tiles-selected' };
81
- }
82
- const multiplier = floor_is_lava_rules_1.FloorIsLavaRules.multiplier(this.roundsSurvived, this.dropsPerRound, edge);
83
- return {
84
- ok: true,
85
- multiplier,
86
- gameAction: { phase: floor_is_lava_rules_1.FloorIsLavaActionPhase.CASHOUT, multiplier, lastSurvivingTile: floor_is_lava_rules_1.FloorIsLavaRules.lastSurvivingTile(generator) },
87
- };
88
- }
89
- static autobet(difficulty, selectedTiles, generator, edge) {
90
- if (selectedTiles.some(tile => !floor_is_lava_rules_1.FloorIsLavaRules.isValidTile(tile))) {
91
- return { ok: false, error: 'invalid-tile' };
92
- }
93
- const dropsPerRound = floor_is_lava_rules_1.DIFFICULTY_DROP_MAP[difficulty];
94
- const maxRounds = floor_is_lava_rules_1.FloorIsLavaRules.maxRounds(difficulty);
95
- if (selectedTiles.length < 1 || selectedTiles.length > maxRounds) {
96
- return { ok: false, error: 'invalid-selected-tiles-count' };
97
- }
98
- const rounds = floor_is_lava_rules_1.FloorIsLavaRules.getRoundResults(generator, dropsPerRound, selectedTiles.length);
99
- const results = [];
100
- let survivedRounds = 0;
101
- const lastSurvivingTile = floor_is_lava_rules_1.FloorIsLavaRules.lastSurvivingTile(generator);
102
- for (let round = 0; round < selectedTiles.length; round++) {
103
- const selectedTile = selectedTiles[round];
104
- const droppedTiles = rounds[round];
105
- const priorDrops = results.flatMap(result => result.droppedTiles);
106
- const isUnselectableDropTile = priorDrops.includes(selectedTile);
107
- if (isUnselectableDropTile) {
108
- results.push({ selectedTile, droppedTiles, outcome: FloorIsLavaAutoBetRoundOutcome.CASHED_OUT });
109
- return {
110
- ok: true,
111
- multiplier: floor_is_lava_rules_1.FloorIsLavaRules.multiplier(survivedRounds, dropsPerRound, edge),
112
- results,
113
- survivedRounds,
114
- lastSurvivingTile,
115
- };
116
- }
117
- const isLoss = droppedTiles.includes(selectedTile);
118
- results.push({ selectedTile, droppedTiles, outcome: isLoss ? FloorIsLavaAutoBetRoundOutcome.LOST : FloorIsLavaAutoBetRoundOutcome.SURVIVED });
119
- if (isLoss) {
120
- return { ok: true, multiplier: (0, bignumber_js_1.default)(0), results, survivedRounds, lastSurvivingTile };
121
- }
122
- survivedRounds++;
123
- }
124
- return {
125
- ok: true,
126
- multiplier: floor_is_lava_rules_1.FloorIsLavaRules.multiplier(survivedRounds, dropsPerRound, edge),
127
- results,
128
- survivedRounds,
129
- lastSurvivingTile,
130
- };
131
- }
132
- }
133
- exports.FloorIsLava = FloorIsLava;
134
- //# sourceMappingURL=floor-is-lava.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"floor-is-lava.js","sourceRoot":"","sources":["../../src/games/floor-is-lava.ts"],"names":[],"mappings":";;;;;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,EAAE,iBAAiB,EAAE,CAAC;YAC5F,CAAC;YACD,cAAc,EAAE,CAAC;QACnB,CAAC;QAED,OAAO;YACL,EAAE,EAAE,IAAI;YACR,UAAU,EAAE,sCAAgB,CAAC,UAAU,CAAC,cAAc,EAAE,aAAa,EAAE,IAAI,CAAC;YAC5E,OAAO;YACP,cAAc;YACd,iBAAiB;SAClB,CAAC;IACJ,CAAC;CACF;AAnID,kCAmIC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"random-number-generator.interface.js","sourceRoot":"","sources":["../../src/games/random-number-generator.interface.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"true-random-rng.js","sourceRoot":"","sources":["../../src/games/true-random-rng.ts"],"names":[],"mappings":";;;AAEA,MAAa,aAAa;IACxB,4BAA4B,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAA+C;QAC3F,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAChG,CAAC;IAED,+BAA+B,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAA+C;QAC9F,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,GAAG,GAAG,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QACtE,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;YAC/B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;YACtD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACxC,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAdD,sCAcC"}