@omnitronix/happy-panda-game-engine 0.0.3 → 0.0.4
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/__tests__/bonus-sequence.test.d.ts +7 -0
- package/dist/__tests__/bonus-sequence.test.d.ts.map +1 -0
- package/dist/__tests__/cherry-frequency.test.d.ts +8 -0
- package/dist/__tests__/cherry-frequency.test.d.ts.map +1 -0
- package/dist/__tests__/counter-manager.test.d.ts +7 -0
- package/dist/__tests__/counter-manager.test.d.ts.map +1 -0
- package/dist/__tests__/cpp-parity.test.d.ts +39 -0
- package/dist/__tests__/cpp-parity.test.d.ts.map +1 -0
- package/dist/__tests__/happy-panda-engine.test.d.ts +7 -0
- package/dist/__tests__/happy-panda-engine.test.d.ts.map +1 -0
- package/dist/__tests__/jackpot-manager.test.d.ts +8 -0
- package/dist/__tests__/jackpot-manager.test.d.ts.map +1 -0
- package/dist/__tests__/jackpot-trigger-trace.test.d.ts +6 -0
- package/dist/__tests__/jackpot-trigger-trace.test.d.ts.map +1 -0
- package/dist/__tests__/rtp-1million.test.d.ts +8 -0
- package/dist/__tests__/rtp-1million.test.d.ts.map +1 -0
- package/dist/__tests__/rtp-analysis.test.d.ts +8 -0
- package/dist/__tests__/rtp-analysis.test.d.ts.map +1 -0
- package/dist/__tests__/rtp-diagnostic.test.d.ts +6 -0
- package/dist/__tests__/rtp-diagnostic.test.d.ts.map +1 -0
- package/dist/__tests__/rtp-simulation.test.d.ts +8 -0
- package/dist/__tests__/rtp-simulation.test.d.ts.map +1 -0
- package/dist/__tests__/special-wins.test.d.ts +7 -0
- package/dist/__tests__/special-wins.test.d.ts.map +1 -0
- package/dist/__tests__/spin-generator.test.d.ts +7 -0
- package/dist/__tests__/spin-generator.test.d.ts.map +1 -0
- package/dist/__tests__/spin-handler.test.d.ts +7 -0
- package/dist/__tests__/spin-handler.test.d.ts.map +1 -0
- package/dist/__tests__/symbol-distribution.test.d.ts +6 -0
- package/dist/__tests__/symbol-distribution.test.d.ts.map +1 -0
- package/dist/__tests__/weighted-random.test.d.ts +7 -0
- package/dist/__tests__/weighted-random.test.d.ts.map +1 -0
- package/dist/__tests__/win-evaluator.test.d.ts +7 -0
- package/dist/__tests__/win-evaluator.test.d.ts.map +1 -0
- package/dist/config/happy-panda.config.d.ts +212 -0
- package/dist/config/happy-panda.config.d.ts.map +1 -0
- package/dist/config/index.d.ts +5 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/domain/index.d.ts +5 -0
- package/dist/domain/index.d.ts.map +1 -0
- package/dist/domain/types.d.ts +205 -0
- package/dist/domain/types.d.ts.map +1 -0
- package/dist/engine/happy-panda-engine.d.ts +50 -0
- package/dist/engine/happy-panda-engine.d.ts.map +1 -0
- package/dist/engine/index.d.ts +5 -0
- package/dist/engine/index.d.ts.map +1 -0
- package/dist/happy-panda-v1.game-engine.d.ts +63 -0
- package/dist/happy-panda-v1.game-engine.d.ts.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/logic/handlers/index.d.ts +5 -0
- package/dist/logic/handlers/index.d.ts.map +1 -0
- package/dist/logic/handlers/spin-handler.d.ts +54 -0
- package/dist/logic/handlers/spin-handler.d.ts.map +1 -0
- package/dist/logic/index.d.ts +6 -0
- package/dist/logic/index.d.ts.map +1 -0
- package/dist/logic/services/counter-manager.d.ts +60 -0
- package/dist/logic/services/counter-manager.d.ts.map +1 -0
- package/dist/logic/services/index.d.ts +7 -0
- package/dist/logic/services/index.d.ts.map +1 -0
- package/dist/logic/services/jackpot-manager.d.ts +59 -0
- package/dist/logic/services/jackpot-manager.d.ts.map +1 -0
- package/dist/logic/services/win-evaluator.d.ts +49 -0
- package/dist/logic/services/win-evaluator.d.ts.map +1 -0
- package/dist/rng/dummy-rng-client.d.ts +39 -0
- package/dist/rng/dummy-rng-client.d.ts.map +1 -0
- package/dist/rng/index.d.ts +10 -0
- package/dist/rng/index.d.ts.map +1 -0
- package/dist/rng/rng-client.factory.d.ts +33 -0
- package/dist/rng/rng-client.factory.d.ts.map +1 -0
- package/dist/rng/rng-client.interface.d.ts +51 -0
- package/dist/rng/rng-client.interface.d.ts.map +1 -0
- package/dist/rng/rng-service.d.ts +93 -0
- package/dist/rng/rng-service.d.ts.map +1 -0
- package/dist/rng/spin-generator.d.ts +31 -0
- package/dist/rng/spin-generator.d.ts.map +1 -0
- package/dist/rng/weighted-random.d.ts +30 -0
- package/dist/rng/weighted-random.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Happy Panda Game Engine - Domain Types
|
|
3
|
+
*
|
|
4
|
+
* Core type definitions for game state and spin results.
|
|
5
|
+
*/
|
|
6
|
+
import { Symbol, SpinType, ScreenWinType } from '../config/happy-panda.config';
|
|
7
|
+
/** 3x3 grid indexed by [reel][row] */
|
|
8
|
+
export type Grid = Symbol[][];
|
|
9
|
+
/** Position on the grid */
|
|
10
|
+
export interface Position {
|
|
11
|
+
reel: number;
|
|
12
|
+
row: number;
|
|
13
|
+
}
|
|
14
|
+
/** Line win result */
|
|
15
|
+
export interface LineWin {
|
|
16
|
+
lineIndex: number;
|
|
17
|
+
symbol: Symbol;
|
|
18
|
+
matchLength: number;
|
|
19
|
+
payout: number;
|
|
20
|
+
positions: Position[];
|
|
21
|
+
}
|
|
22
|
+
/** Wall (3x3) win result */
|
|
23
|
+
export interface WallWin {
|
|
24
|
+
wallType: ScreenWinType;
|
|
25
|
+
payout: number;
|
|
26
|
+
positions: Position[];
|
|
27
|
+
}
|
|
28
|
+
/** Scatter win result (Seven/Super Seven) */
|
|
29
|
+
export interface ScatterWin {
|
|
30
|
+
symbol: Symbol;
|
|
31
|
+
count: number;
|
|
32
|
+
payout: number;
|
|
33
|
+
positions: Position[];
|
|
34
|
+
isSuperSevenOnly: boolean;
|
|
35
|
+
}
|
|
36
|
+
/** Special bonus win (cherry pieces, bell scatter, super bar scatter) */
|
|
37
|
+
export interface SpecialWin {
|
|
38
|
+
winType: ScreenWinType;
|
|
39
|
+
count: number;
|
|
40
|
+
payout: number;
|
|
41
|
+
positions: Position[];
|
|
42
|
+
}
|
|
43
|
+
/** Combined win result for a spin */
|
|
44
|
+
export interface SpinWinResult {
|
|
45
|
+
lineWins: LineWin[];
|
|
46
|
+
wallWin: WallWin | null;
|
|
47
|
+
scatterWins: ScatterWin[];
|
|
48
|
+
specialWins: SpecialWin[];
|
|
49
|
+
totalPayout: number;
|
|
50
|
+
}
|
|
51
|
+
/** Bonus counter state */
|
|
52
|
+
export interface BonusCounters {
|
|
53
|
+
/** Jackpot bonus counter (triggers at 0, resets to 1) */
|
|
54
|
+
jackpot: number;
|
|
55
|
+
/** Cherry bonus counter (triggers at 0, resets to 6 or 9) */
|
|
56
|
+
cherry: number;
|
|
57
|
+
/** Bell bonus counter (triggers at 0, resets to 3 or 5) */
|
|
58
|
+
bell: number;
|
|
59
|
+
/** Bar1 bonus counter (triggers at 0, resets to 1) */
|
|
60
|
+
bar1: number;
|
|
61
|
+
}
|
|
62
|
+
/** Pending bonus queue */
|
|
63
|
+
export interface PendingBonuses {
|
|
64
|
+
/** Number of pending jackpot bonuses */
|
|
65
|
+
jackpot: number;
|
|
66
|
+
/** Number of pending cherry bonuses */
|
|
67
|
+
cherry: number;
|
|
68
|
+
/** Number of pending bell bonuses (each grants 5 spins) */
|
|
69
|
+
bell: number;
|
|
70
|
+
/** Number of pending bar1 bonuses (each grants 7 spins) */
|
|
71
|
+
bar1: number;
|
|
72
|
+
/** Number of pending center cherry respins */
|
|
73
|
+
respin: number;
|
|
74
|
+
}
|
|
75
|
+
/** Jackpot state */
|
|
76
|
+
export interface JackpotState {
|
|
77
|
+
/** Progressive jackpot value (accumulates on losing paid spins) */
|
|
78
|
+
bonusJackpotValue: number;
|
|
79
|
+
/** Pool jackpot value (paid when bell bonus triggers) */
|
|
80
|
+
poolJackpotValue: number;
|
|
81
|
+
}
|
|
82
|
+
/** Game direction/mode */
|
|
83
|
+
export declare enum GameDirection {
|
|
84
|
+
SINGLE = 0,// 8 lines
|
|
85
|
+
BOTH = 1
|
|
86
|
+
}
|
|
87
|
+
/** Core game state */
|
|
88
|
+
export interface GameState {
|
|
89
|
+
/** Game mode (8 or 16 lines) */
|
|
90
|
+
gameDirection: GameDirection;
|
|
91
|
+
/** Bet multiplier (line bet) */
|
|
92
|
+
betStake: number;
|
|
93
|
+
/** Total bet per spin (8 or 16 x betStake) */
|
|
94
|
+
betGame: number;
|
|
95
|
+
/** Current spin type */
|
|
96
|
+
currentSpinType: SpinType;
|
|
97
|
+
/** Next spin type (determined after current spin) */
|
|
98
|
+
nextSpinType: SpinType;
|
|
99
|
+
/** Remaining spins in current bonus (0 for paid spin) */
|
|
100
|
+
spinsRemaining: number;
|
|
101
|
+
/** Bonus counters */
|
|
102
|
+
counters: BonusCounters;
|
|
103
|
+
/** Pending bonuses to execute */
|
|
104
|
+
pendingBonuses: PendingBonuses;
|
|
105
|
+
/** Jackpot values */
|
|
106
|
+
jackpots: JackpotState;
|
|
107
|
+
/** Current grid (3x3) */
|
|
108
|
+
grid: Grid;
|
|
109
|
+
/** Accumulated bonus wins (reset when bonus sequence ends) */
|
|
110
|
+
accumulatedBonusWins: number;
|
|
111
|
+
/** Center cherry symbol for respin (if active) */
|
|
112
|
+
centerCherrySymbol: Symbol | null;
|
|
113
|
+
}
|
|
114
|
+
/** State visible to client */
|
|
115
|
+
export interface PublicState {
|
|
116
|
+
gameDirection: GameDirection;
|
|
117
|
+
betStake: number;
|
|
118
|
+
betGame: number;
|
|
119
|
+
currentSpinType: SpinType;
|
|
120
|
+
spinsRemaining: number;
|
|
121
|
+
grid: Grid;
|
|
122
|
+
bonusJackpotValue: number;
|
|
123
|
+
poolJackpotValue: number;
|
|
124
|
+
/** Indicates if a bonus is pending (without revealing which) */
|
|
125
|
+
hasPendingBonus: boolean;
|
|
126
|
+
}
|
|
127
|
+
/** Server-side only state */
|
|
128
|
+
export interface PrivateState {
|
|
129
|
+
counters: BonusCounters;
|
|
130
|
+
pendingBonuses: PendingBonuses;
|
|
131
|
+
nextSpinType: SpinType;
|
|
132
|
+
accumulatedBonusWins: number;
|
|
133
|
+
centerCherrySymbol: Symbol | null;
|
|
134
|
+
}
|
|
135
|
+
/** Spin request from client */
|
|
136
|
+
export interface SpinRequest {
|
|
137
|
+
/** Session ID */
|
|
138
|
+
sessionId: string;
|
|
139
|
+
/** Game direction (8 or 16 lines) */
|
|
140
|
+
gameDirection: GameDirection;
|
|
141
|
+
/** Bet multiplier */
|
|
142
|
+
betStake: number;
|
|
143
|
+
}
|
|
144
|
+
/** Spin response to client */
|
|
145
|
+
export interface SpinResponse {
|
|
146
|
+
/** Session ID */
|
|
147
|
+
sessionId: string;
|
|
148
|
+
/** Resulting grid */
|
|
149
|
+
grid: Grid;
|
|
150
|
+
/** Win results */
|
|
151
|
+
wins: SpinWinResult;
|
|
152
|
+
/** Updated public state */
|
|
153
|
+
state: PublicState;
|
|
154
|
+
/** Jackpot won this spin (if any) */
|
|
155
|
+
jackpotWon: number;
|
|
156
|
+
/** Pool jackpot won this spin (if any) */
|
|
157
|
+
poolJackpotWon: number;
|
|
158
|
+
/** Bonus type triggered (for animation) */
|
|
159
|
+
bonusTriggered: SpinType | null;
|
|
160
|
+
/** Is this the final spin of a bonus sequence */
|
|
161
|
+
isBonusComplete: boolean;
|
|
162
|
+
}
|
|
163
|
+
/** Full session state (for persistence) */
|
|
164
|
+
export interface SessionState {
|
|
165
|
+
sessionId: string;
|
|
166
|
+
publicState: PublicState;
|
|
167
|
+
privateState: PrivateState;
|
|
168
|
+
createdAt: Date;
|
|
169
|
+
updatedAt: Date;
|
|
170
|
+
}
|
|
171
|
+
/** RNG interface for dependency injection */
|
|
172
|
+
export interface RngProvider {
|
|
173
|
+
/** Generate random integer in range [0, max) */
|
|
174
|
+
random(max: number): Promise<number>;
|
|
175
|
+
/** Generate multiple random integers */
|
|
176
|
+
randomBatch(count: number, max: number): Promise<number[]>;
|
|
177
|
+
}
|
|
178
|
+
/** Game command types */
|
|
179
|
+
export declare enum CommandType {
|
|
180
|
+
INIT_SESSION_STATE = "INIT_SESSION_STATE",
|
|
181
|
+
SPIN = "SPIN",
|
|
182
|
+
GET_SYMBOLS = "GET_SYMBOLS"
|
|
183
|
+
}
|
|
184
|
+
/** Command request base */
|
|
185
|
+
export interface CommandRequest {
|
|
186
|
+
command: CommandType;
|
|
187
|
+
sessionId: string;
|
|
188
|
+
}
|
|
189
|
+
/** Init session command */
|
|
190
|
+
export interface InitSessionRequest extends CommandRequest {
|
|
191
|
+
command: CommandType.INIT_SESSION_STATE;
|
|
192
|
+
gameDirection: GameDirection;
|
|
193
|
+
betStake: number;
|
|
194
|
+
}
|
|
195
|
+
/** Spin command */
|
|
196
|
+
export interface SpinCommandRequest extends CommandRequest {
|
|
197
|
+
command: CommandType.SPIN;
|
|
198
|
+
}
|
|
199
|
+
/** Get symbols command */
|
|
200
|
+
export interface GetSymbolsRequest extends CommandRequest {
|
|
201
|
+
command: CommandType.GET_SYMBOLS;
|
|
202
|
+
}
|
|
203
|
+
/** Union of all commands */
|
|
204
|
+
export type GameCommand = InitSessionRequest | SpinCommandRequest | GetSymbolsRequest;
|
|
205
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/domain/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAM/E,sCAAsC;AACtC,MAAM,MAAM,IAAI,GAAG,MAAM,EAAE,EAAE,CAAC;AAE9B,2BAA2B;AAC3B,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACb;AAMD,sBAAsB;AACtB,MAAM,WAAW,OAAO;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,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,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CAC5D;AAMD,yBAAyB;AACzB,oBAAY,WAAW;IACrB,kBAAkB,uBAAuB;IACzC,IAAI,SAAS;IACb,WAAW,gBAAgB;CAC5B;AAED,2BAA2B;AAC3B,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,WAAW,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,2BAA2B;AAC3B,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACxD,OAAO,EAAE,WAAW,CAAC,kBAAkB,CAAC;IACxC,aAAa,EAAE,aAAa,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,mBAAmB;AACnB,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACxD,OAAO,EAAE,WAAW,CAAC,IAAI,CAAC;CAC3B;AAED,0BAA0B;AAC1B,MAAM,WAAW,iBAAkB,SAAQ,cAAc;IACvD,OAAO,EAAE,WAAW,CAAC,WAAW,CAAC;CAClC;AAED,4BAA4B;AAC5B,MAAM,MAAM,WAAW,GAAG,kBAAkB,GAAG,kBAAkB,GAAG,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Happy Panda Game Engine
|
|
3
|
+
*
|
|
4
|
+
* Main engine class that provides the public API for the game.
|
|
5
|
+
* Implements the command pattern used by other Omnitronix game engines.
|
|
6
|
+
*/
|
|
7
|
+
import { GameDirection, SessionState, RngProvider, GameCommand } from '../domain/types';
|
|
8
|
+
export declare class HappyPandaEngine {
|
|
9
|
+
private rng;
|
|
10
|
+
constructor(rngProvider: RngProvider);
|
|
11
|
+
/**
|
|
12
|
+
* Handle a game command.
|
|
13
|
+
*/
|
|
14
|
+
handleCommand(command: GameCommand, currentState?: SessionState): Promise<{
|
|
15
|
+
response: unknown;
|
|
16
|
+
state: SessionState;
|
|
17
|
+
}>;
|
|
18
|
+
private handleInitSession;
|
|
19
|
+
private handleSpin;
|
|
20
|
+
private handleGetSymbols;
|
|
21
|
+
/**
|
|
22
|
+
* Extract public state from game state.
|
|
23
|
+
*/
|
|
24
|
+
private extractPublicState;
|
|
25
|
+
/**
|
|
26
|
+
* Extract private state from game state.
|
|
27
|
+
*/
|
|
28
|
+
private extractPrivateState;
|
|
29
|
+
/**
|
|
30
|
+
* Create session state from game state.
|
|
31
|
+
*/
|
|
32
|
+
private createSessionState;
|
|
33
|
+
/**
|
|
34
|
+
* Reconstruct game state from session state.
|
|
35
|
+
*/
|
|
36
|
+
private reconstructGameState;
|
|
37
|
+
/**
|
|
38
|
+
* Create empty session for commands that don't need state.
|
|
39
|
+
*/
|
|
40
|
+
private createEmptySession;
|
|
41
|
+
/**
|
|
42
|
+
* Update bet settings (only when no bonus pending).
|
|
43
|
+
*/
|
|
44
|
+
updateBet(session: SessionState, gameDirection: GameDirection, betStake: number): SessionState;
|
|
45
|
+
/**
|
|
46
|
+
* Check if player can change bet.
|
|
47
|
+
*/
|
|
48
|
+
canChangeBet(session: SessionState): boolean;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=happy-panda-engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"happy-panda-engine.d.ts","sourceRoot":"","sources":["../../src/engine/happy-panda-engine.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAEL,aAAa,EAGb,YAAY,EACZ,WAAW,EAEX,WAAW,EAIZ,MAAM,iBAAiB,CAAC;AAczB,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,GAAG,CAAc;gBAEb,WAAW,EAAE,WAAW;IAQpC;;OAEG;IACG,aAAa,CACjB,OAAO,EAAE,WAAW,EACpB,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC;QAAE,QAAQ,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,YAAY,CAAA;KAAE,CAAC;YAuBxC,iBAAiB;YAiBjB,UAAU;YAiCV,gBAAgB;IAkB9B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAc1B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAU3B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAU1B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAuB5B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAoB1B;;OAEG;IACH,SAAS,CACP,OAAO,EAAE,YAAY,EACrB,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,MAAM,GACf,YAAY;IAMf;;OAEG;IACH,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO;CAM7C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/engine/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HappyPandaV1GameEngine
|
|
3
|
+
*
|
|
4
|
+
* Wrapper class that adapts HappyPandaEngine to the standard GameEngine interface
|
|
5
|
+
* expected by the game-engine-service infrastructure.
|
|
6
|
+
*
|
|
7
|
+
* Uses the proper RNG infrastructure matching Heroes of Aether and Bonny's Fortune:
|
|
8
|
+
* - RngClientFactory for environment-based client selection
|
|
9
|
+
* - RngService for audit trail tracking
|
|
10
|
+
* - Full RNG outcome reporting for compliance
|
|
11
|
+
*/
|
|
12
|
+
import { PublicState, PrivateState } from './domain/types';
|
|
13
|
+
import { RngOutcome, RngOutcomeRecord } from './rng/rng-service';
|
|
14
|
+
export { RngOutcome, RngOutcomeRecord };
|
|
15
|
+
export interface GameEngineInfo {
|
|
16
|
+
gameCode: string;
|
|
17
|
+
version: string;
|
|
18
|
+
rtp: number;
|
|
19
|
+
gameType: string;
|
|
20
|
+
gameName: string;
|
|
21
|
+
provider: string;
|
|
22
|
+
}
|
|
23
|
+
export interface CommandProcessingResult<TPublicState = unknown, TPrivateState = unknown, TOutcome = unknown> {
|
|
24
|
+
success: boolean;
|
|
25
|
+
publicState: TPublicState;
|
|
26
|
+
privateState: TPrivateState;
|
|
27
|
+
outcome?: TOutcome;
|
|
28
|
+
message?: string;
|
|
29
|
+
rngOutcome?: RngOutcome;
|
|
30
|
+
}
|
|
31
|
+
export interface GameActionCommand<TPayload = unknown> {
|
|
32
|
+
id: string;
|
|
33
|
+
type: string;
|
|
34
|
+
payload?: TPayload;
|
|
35
|
+
}
|
|
36
|
+
export interface GameEngine<TPublicState = unknown, TPrivateState = unknown, TOutcome = unknown> {
|
|
37
|
+
processCommand(publicState: TPublicState, privateState: TPrivateState, command: GameActionCommand): Promise<CommandProcessingResult<TPublicState, TPrivateState, TOutcome>>;
|
|
38
|
+
getGameEngineInfo(): GameEngineInfo;
|
|
39
|
+
}
|
|
40
|
+
export interface HappyPandaV1GameEngineConfig {
|
|
41
|
+
metrics?: unknown;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Happy Panda V1 Game Engine
|
|
45
|
+
*
|
|
46
|
+
* Implements the standard GameEngine interface for use with game-engine-service.
|
|
47
|
+
* Uses proper RNG infrastructure with full audit trail support.
|
|
48
|
+
*/
|
|
49
|
+
export declare class HappyPandaV1GameEngine implements GameEngine<PublicState, PrivateState, unknown> {
|
|
50
|
+
private readonly gameCode;
|
|
51
|
+
private readonly version;
|
|
52
|
+
private readonly rtp;
|
|
53
|
+
private readonly gameType;
|
|
54
|
+
private readonly gameName;
|
|
55
|
+
private readonly provider;
|
|
56
|
+
private readonly rngService;
|
|
57
|
+
private readonly rngAdapter;
|
|
58
|
+
private readonly engine;
|
|
59
|
+
constructor(config?: HappyPandaV1GameEngineConfig);
|
|
60
|
+
getGameEngineInfo(): GameEngineInfo;
|
|
61
|
+
processCommand(publicState: PublicState | null, privateState: PrivateState | null, command: GameActionCommand): Promise<CommandProcessingResult<PublicState, PrivateState, unknown>>;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=happy-panda-v1.game-engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"happy-panda-v1.game-engine.d.ts","sourceRoot":"","sources":["../src/happy-panda-v1.game-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAGL,WAAW,EACX,YAAY,EAGb,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAc,UAAU,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG7E,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,CAAC;AAGxC,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,uBAAuB,CACtC,YAAY,GAAG,OAAO,EACtB,aAAa,GAAG,OAAO,EACvB,QAAQ,GAAG,OAAO;IAElB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,YAAY,CAAC;IAC1B,YAAY,EAAE,aAAa,CAAC;IAC5B,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB,CAAC,QAAQ,GAAG,OAAO;IACnD,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,QAAQ,CAAC;CACpB;AAED,MAAM,WAAW,UAAU,CACzB,YAAY,GAAG,OAAO,EACtB,aAAa,GAAG,OAAO,EACvB,QAAQ,GAAG,OAAO;IAElB,cAAc,CACZ,WAAW,EAAE,YAAY,EACzB,YAAY,EAAE,aAAa,EAC3B,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,uBAAuB,CAAC,YAAY,EAAE,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE3E,iBAAiB,IAAI,cAAc,CAAC;CACrC;AAoCD,MAAM,WAAW,4BAA4B;IAC3C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;GAKG;AACH,qBAAa,sBACX,YAAW,UAAU,CAAC,WAAW,EAAE,YAAY,EAAE,OAAO,CAAC;IAEzD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiB;IAC1C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAW;IACnC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAU;IACnC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiB;IAC1C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgB;IAEzC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAoB;IAC/C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmB;gBAE9B,MAAM,GAAE,4BAAiC;IAc9C,iBAAiB,IAAI,cAAc;IAW7B,cAAc,CACzB,WAAW,EAAE,WAAW,GAAG,IAAI,EAC/B,YAAY,EAAE,YAAY,GAAG,IAAI,EACjC,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,uBAAuB,CAAC,WAAW,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;CAmHxE"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Happy Panda Game Engine
|
|
3
|
+
*
|
|
4
|
+
* A 3x3 slot game engine with 8/16 bidirectional paylines.
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
export { HappyPandaV1GameEngine } from './happy-panda-v1.game-engine';
|
|
9
|
+
export type { GameEngine, GameEngineInfo, GameActionCommand, CommandProcessingResult, RngOutcome, RngOutcomeRecord, } from './happy-panda-v1.game-engine';
|
|
10
|
+
export { HappyPandaEngine } from './engine';
|
|
11
|
+
export { Symbol, SpinType, ScreenWinType, GRID, LINE_SHAPES, LINES_PER_DIRECTION, } from './config';
|
|
12
|
+
export { Grid, Position, LineWin, WallWin, ScatterWin, SpecialWin, SpinWinResult, BonusCounters, PendingBonuses, JackpotState, GameDirection, GameState, PublicState, PrivateState, SpinRequest, SpinResponse, SessionState, RngProvider, CommandType, GameCommand, InitSessionRequest, SpinCommandRequest, GetSymbolsRequest, } from './domain';
|
|
13
|
+
export { evaluateSpin, evaluateLineWins, evaluateWallWin, evaluateScatterWins } from './logic/services';
|
|
14
|
+
export { generateGrid } from './rng';
|
|
15
|
+
export { IRngClient, RngSingleResponse, RngBatchResponse, } from './rng/rng-client.interface';
|
|
16
|
+
export { DummyRngClient } from './rng/dummy-rng-client';
|
|
17
|
+
export { RngClientFactory, RngClientConfig } from './rng/rng-client.factory';
|
|
18
|
+
export { RngService } from './rng/rng-service';
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,YAAY,EACV,UAAU,EACV,cAAc,EACd,iBAAiB,EACjB,uBAAuB,EACvB,UAAU,EACV,gBAAgB,GACjB,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAG5C,OAAO,EACL,MAAM,EACN,QAAQ,EACR,aAAa,EACb,IAAI,EACJ,WAAW,EACX,mBAAmB,GACpB,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,OAAO,EACP,UAAU,EACV,UAAU,EACV,aAAa,EACb,aAAa,EACb,cAAc,EACd,YAAY,EACZ,aAAa,EACb,SAAS,EACT,WAAW,EACX,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,EACX,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACxG,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAGrC,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/logic/handlers/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spin Handler
|
|
3
|
+
*
|
|
4
|
+
* Coordinates the entire spin flow:
|
|
5
|
+
* 1. Determine spin type
|
|
6
|
+
* 2. Generate grid
|
|
7
|
+
* 3. Evaluate wins
|
|
8
|
+
* 4. Update counters
|
|
9
|
+
* 5. Update jackpots
|
|
10
|
+
* 6. Determine next spin type
|
|
11
|
+
* 7. Build response
|
|
12
|
+
*/
|
|
13
|
+
import { SpinType } from '../../config/happy-panda.config';
|
|
14
|
+
import { Grid, GameDirection, GameState, SpinWinResult, RngProvider } from '../../domain/types';
|
|
15
|
+
export interface SpinResult {
|
|
16
|
+
/** Resulting grid */
|
|
17
|
+
grid: Grid;
|
|
18
|
+
/** Win evaluation results */
|
|
19
|
+
wins: SpinWinResult;
|
|
20
|
+
/** Updated game state */
|
|
21
|
+
state: GameState;
|
|
22
|
+
/** Progressive jackpot won (if any) */
|
|
23
|
+
jackpotWon: number;
|
|
24
|
+
/** Pool jackpot won (if any) */
|
|
25
|
+
poolJackpotWon: number;
|
|
26
|
+
/** Bonus type triggered this spin */
|
|
27
|
+
bonusTriggered: SpinType | null;
|
|
28
|
+
/** Is this the final spin of bonus sequence */
|
|
29
|
+
isBonusComplete: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Execute a single spin.
|
|
33
|
+
*/
|
|
34
|
+
export declare function executeSpin(state: GameState, rng: RngProvider): Promise<SpinResult>;
|
|
35
|
+
/** Minimum bet stake */
|
|
36
|
+
export declare const MIN_BET_STAKE = 1;
|
|
37
|
+
/** Maximum bet stake (reasonable upper bound) */
|
|
38
|
+
export declare const MAX_BET_STAKE = 100;
|
|
39
|
+
/**
|
|
40
|
+
* Validate bet parameters.
|
|
41
|
+
* @throws Error if parameters are invalid
|
|
42
|
+
*/
|
|
43
|
+
export declare function validateBetParams(gameDirection: GameDirection, betStake: number): void;
|
|
44
|
+
/**
|
|
45
|
+
* Create initial game state.
|
|
46
|
+
* @throws Error if parameters are invalid
|
|
47
|
+
*/
|
|
48
|
+
export declare function createInitialState(gameDirection: GameDirection, betStake: number): GameState;
|
|
49
|
+
/**
|
|
50
|
+
* Update state for new bet.
|
|
51
|
+
* @throws Error if parameters are invalid
|
|
52
|
+
*/
|
|
53
|
+
export declare function updateBet(state: GameState, gameDirection: GameDirection, betStake: number): GameState;
|
|
54
|
+
//# sourceMappingURL=spin-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spin-handler.d.ts","sourceRoot":"","sources":["../../../src/logic/handlers/spin-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAEL,QAAQ,EAET,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL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
3
|
+
*
|
|
4
|
+
* Manages bonus counters and trigger detection.
|
|
5
|
+
* Each bonus type has a counter that decrements on specific events.
|
|
6
|
+
* When a counter reaches 0, the bonus is triggered.
|
|
7
|
+
*/
|
|
8
|
+
import { SpinType } from '../../config/happy-panda.config';
|
|
9
|
+
import { Grid, GameDirection, BonusCounters, PendingBonuses, LineWin, RngProvider } from '../../domain/types';
|
|
10
|
+
/**
|
|
11
|
+
* Create initial bonus counters.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createInitialCounters(): BonusCounters;
|
|
14
|
+
/**
|
|
15
|
+
* Create empty pending bonuses.
|
|
16
|
+
*/
|
|
17
|
+
export declare function createEmptyPendingBonuses(): PendingBonuses;
|
|
18
|
+
/**
|
|
19
|
+
* Randomize cherry counter initial value (6 or 9).
|
|
20
|
+
*/
|
|
21
|
+
export declare function randomizeCherryCounter(gameDirection: GameDirection, rng: RngProvider): Promise<number>;
|
|
22
|
+
/**
|
|
23
|
+
* Randomize bell counter initial value (3 or 5).
|
|
24
|
+
*/
|
|
25
|
+
export declare function randomizeBellCounter(gameDirection: GameDirection, rng: RngProvider): Promise<number>;
|
|
26
|
+
/** Result of counter update */
|
|
27
|
+
export interface CounterUpdateResult {
|
|
28
|
+
counters: BonusCounters;
|
|
29
|
+
pendingBonuses: PendingBonuses;
|
|
30
|
+
triggeredJackpot: boolean;
|
|
31
|
+
triggeredCherry: boolean;
|
|
32
|
+
triggeredBell: boolean;
|
|
33
|
+
triggeredBar1: boolean;
|
|
34
|
+
triggeredRespin: number;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Update counters based on spin results.
|
|
38
|
+
* Only applies during paid_spin and respin_cherry.
|
|
39
|
+
*/
|
|
40
|
+
export declare function updateCounters(currentCounters: BonusCounters, currentPending: PendingBonuses, lineWins: LineWin[], grid: Grid, gameDirection: GameDirection, spinType: SpinType, totalWin: number, rng: RngProvider): Promise<CounterUpdateResult>;
|
|
41
|
+
/** Bonus type to consume */
|
|
42
|
+
export type BonusType = 'jackpot' | 'cherry' | 'bell' | 'bar1' | 'respin';
|
|
43
|
+
/**
|
|
44
|
+
* Get the next bonus type to execute (priority order).
|
|
45
|
+
* Returns null if no bonuses pending.
|
|
46
|
+
*/
|
|
47
|
+
export declare function getNextBonusType(pending: PendingBonuses): BonusType | null;
|
|
48
|
+
/**
|
|
49
|
+
* Consume one bonus from pending.
|
|
50
|
+
* Returns updated pending and number of spins for that bonus.
|
|
51
|
+
*/
|
|
52
|
+
export declare function consumeBonus(pending: PendingBonuses, bonusType: BonusType): {
|
|
53
|
+
pending: PendingBonuses;
|
|
54
|
+
spins: number;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Check if any bonus is pending.
|
|
58
|
+
*/
|
|
59
|
+
export declare function hasPendingBonus(pending: PendingBonuses): boolean;
|
|
60
|
+
//# sourceMappingURL=counter-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"counter-manager.d.ts","sourceRoot":"","sources":["../../../src/logic/services/counter-manager.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAEL,QAAQ,EAOT,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,IAAI,EACJ,aAAa,EACb,aAAa,EACb,cAAc,EACd,OAAO,EACP,WAAW,EACZ,MAAM,oBAAoB,CAAC;AAO5B;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,aAAa,CAOrD;AAED;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,cAAc,CAQ1D;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,aAAa,EAAE,aAAa,EAC5B,GAAG,EAAE,WAAW,GACf,OAAO,CAAC,MAAM,CAAC,CAIjB;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACxC,aAAa,EAAE,aAAa,EAC5B,GAAG,EAAE,WAAW,GACf,OAAO,CAAC,MAAM,CAAC,CAIjB;AAMD,+BAA+B;AAC/B,MAAM,WAAW,mBAA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4
|
+
* Manages progressive jackpot and pool jackpot values.
|
|
5
|
+
*
|
|
6
|
+
* Progressive Jackpot (Bonus Jackpot):
|
|
7
|
+
* - Starts at 100 x bet_game
|
|
8
|
+
* - On losing paid spins: 3/13 chance to increase by 1-2 x bet_stake
|
|
9
|
+
* - Max: 1000 x bet_game
|
|
10
|
+
* - Paid when Jackpot Bonus triggered
|
|
11
|
+
*
|
|
12
|
+
* Pool Jackpot:
|
|
13
|
+
* - Starts at 0
|
|
14
|
+
* - Increases when Seven/Super Seven in center with no wins
|
|
15
|
+
* - Max: 250 x bet_game
|
|
16
|
+
* - Paid when Bell Bonus triggered
|
|
17
|
+
*/
|
|
18
|
+
import { SpinType } from '../../config/happy-panda.config';
|
|
19
|
+
import { Grid, GameDirection, JackpotState, RngProvider } from '../../domain/types';
|
|
20
|
+
/**
|
|
21
|
+
* Create initial jackpot state.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createInitialJackpots(betGame: number): JackpotState;
|
|
24
|
+
/**
|
|
25
|
+
* Update progressive jackpot value on losing paid spin.
|
|
26
|
+
* 3/13 probability to increase.
|
|
27
|
+
*/
|
|
28
|
+
export declare function updateProgressiveJackpot(currentValue: number, gameDirection: GameDirection, betGame: number, betStake: number, spinType: SpinType, totalWin: number, rng: RngProvider): Promise<number>;
|
|
29
|
+
/**
|
|
30
|
+
* Pay out progressive jackpot and reset.
|
|
31
|
+
*/
|
|
32
|
+
export declare function payProgressiveJackpot(currentValue: number, betGame: number): {
|
|
33
|
+
payout: number;
|
|
34
|
+
newValue: number;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Update pool jackpot value.
|
|
38
|
+
* Increases when Seven/Super Seven in center position with no wins.
|
|
39
|
+
* IMPORTANT: Must be the ONLY Seven on the entire screen (per C++ math model).
|
|
40
|
+
*/
|
|
41
|
+
export declare function updatePoolJackpot(currentValue: number, grid: Grid, gameDirection: GameDirection, betGame: number, betStake: number, spinType: SpinType, totalWin: number): number;
|
|
42
|
+
/**
|
|
43
|
+
* Pay out pool jackpot and reset.
|
|
44
|
+
*/
|
|
45
|
+
export declare function payPoolJackpot(currentValue: number, betGame: number): {
|
|
46
|
+
payout: number;
|
|
47
|
+
newValue: number;
|
|
48
|
+
};
|
|
49
|
+
/** Result of jackpot updates */
|
|
50
|
+
export interface JackpotUpdateResult {
|
|
51
|
+
jackpots: JackpotState;
|
|
52
|
+
progressiveJackpotIncreased: boolean;
|
|
53
|
+
poolJackpotIncreased: boolean;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Update both jackpot values after a spin.
|
|
57
|
+
*/
|
|
58
|
+
export declare function updateJackpots(currentJackpots: JackpotState, grid: Grid, gameDirection: GameDirection, betGame: number, betStake: number, spinType: SpinType, totalWin: number, rng: RngProvider): Promise<JackpotUpdateResult>;
|
|
59
|
+
//# sourceMappingURL=jackpot-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jackpot-manager.d.ts","sourceRoot":"","sources":["../../../src/logic/services/jackpot-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAEL,QAAQ,EAIT,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAOpF;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,CAKnE;AAMD;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,WAAW,GACf,OAAO,CAAC,MAAM,CAAC,CAyBjB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,GACd;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAItC;AAMD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,IAAI,EACV,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,MAAM,GACf,MAAM,CAsCR;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,GACd;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAItC;AAMD,gCAAgC;AAChC,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,YAAY,CAAC;IACvB,2BAA2B,EAAE,OAAO,CAAC;IACrC,oBAAoB,EAAE,OAAO,CAAC;CAC/B;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,eAAe,EAAE,YAAY,EAC7B,IAAI,EAAE,IAAI,EACV,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,WAAW,GACf,OAAO,CAAC,mBAAmB,CAAC,CAgC9B"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Win Evaluator Service
|
|
3
|
+
*
|
|
4
|
+
* Evaluates wins on a 3x3 grid with correct priority:
|
|
5
|
+
* 1. Wall wins (3x3) - suppress line wins
|
|
6
|
+
* 2. Scatter wins (Seven/Super Seven) - suppress line wins
|
|
7
|
+
* 3. Line wins (only if no wall or scatter)
|
|
8
|
+
* 4. Special wins (bonus-specific)
|
|
9
|
+
*/
|
|
10
|
+
import { SpinType } from '../../config/happy-panda.config';
|
|
11
|
+
import { Grid, GameDirection, LineWin, WallWin, ScatterWin, SpecialWin, SpinWinResult } from '../../domain/types';
|
|
12
|
+
/**
|
|
13
|
+
* Evaluate wall (3x3) wins.
|
|
14
|
+
* Wall wins require all 9 positions to be the same symbol or valid mix.
|
|
15
|
+
*/
|
|
16
|
+
export declare function evaluateWallWin(grid: Grid, betGame: number): WallWin | null;
|
|
17
|
+
/**
|
|
18
|
+
* Evaluate Seven/Super Seven scatter wins.
|
|
19
|
+
* C++ can award TWO scatter wins:
|
|
20
|
+
* 1. Super Seven only scatter (if SEV_S >= 2, doubled if no regular Sevens)
|
|
21
|
+
* 2. Total count scatter (if total >= 2 AND at least 1 regular Seven)
|
|
22
|
+
* Plus +bet_game bonus if exactly 1 Super Seven
|
|
23
|
+
*/
|
|
24
|
+
export declare function evaluateScatterWins(grid: Grid, betGame: number): ScatterWin[];
|
|
25
|
+
/**
|
|
26
|
+
* Evaluate all line wins.
|
|
27
|
+
*/
|
|
28
|
+
export declare function evaluateLineWins(grid: Grid, gameDirection: GameDirection, betStake: number): LineWin[];
|
|
29
|
+
/**
|
|
30
|
+
* Evaluate cherry piece line wins (Jackpot Bonus).
|
|
31
|
+
* Cherry pieces on lines pay special multiplier.
|
|
32
|
+
*/
|
|
33
|
+
export declare function evaluateCherryPieceWins(grid: Grid, gameDirection: GameDirection, betStake: number): SpecialWin[];
|
|
34
|
+
/**
|
|
35
|
+
* Evaluate bell scatter wins (Bell Bonus).
|
|
36
|
+
* Each bell pays as scatter during bonus.
|
|
37
|
+
*/
|
|
38
|
+
export declare function evaluateBellScatterWins(grid: Grid, gameDirection: GameDirection, betStake: number): SpecialWin | null;
|
|
39
|
+
/**
|
|
40
|
+
* Evaluate super bar scatter wins (Bar1 Bonus).
|
|
41
|
+
* Each super bar pays as scatter during bonus.
|
|
42
|
+
*/
|
|
43
|
+
export declare function evaluateSuperBarScatterWins(grid: Grid, gameDirection: GameDirection, betStake: number): SpecialWin | null;
|
|
44
|
+
/**
|
|
45
|
+
* Evaluate all wins for a spin.
|
|
46
|
+
* Implements correct priority: Wall > Scatter > Lines
|
|
47
|
+
*/
|
|
48
|
+
export declare function evaluateSpin(grid: Grid, gameDirection: GameDirection, betStake: number, betGame: number, spinType: SpinType): SpinWinResult;
|
|
49
|
+
//# sourceMappingURL=win-evaluator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"win-evaluator.d.ts","sourceRoot":"","sources":["../../../src/logic/services/win-evaluator.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAEL,QAAQ,EAiBT,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,IAAI,EACJ,aAAa,EAEb,OAAO,EACP,OAAO,EACP,UAAU,EACV,UAAU,EACV,aAAa,EACd,MAAM,oBAAoB,CAAC;AAqE5B;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,MAAM,GACd,OAAO,GAAG,IAAI,CAmEhB;AAMD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,MAAM,GACd,UAAU,EAAE,CAsDd;AAmGD;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,IAAI,EACV,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,MAAM,GACf,OAAO,EAAE,CAYX;AAMD;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,IAAI,EACV,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,MAAM,GACf,UAAU,EAAE,CAmCd;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,IAAI,EACV,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,MAAM,GACf,UAAU,GAAG,IAAI,CAcnB;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,IAAI,EACV,aAAa,EAAE,aAAa,EAC5B,Q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