Merge branch 'main' into documentation

This commit is contained in:
Max 2025-06-25 15:46:19 +02:00 committed by GitHub
commit 34f0cd7ac4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 3649 additions and 78 deletions

View file

@ -384,3 +384,38 @@ export function getPrestigeColor(level: number): string {
export function getMaxPrestigeLevel(): number {
return 5;
}
export function calculateMinesMultiplier(picks: number, mines: number, betAmount: number): number {
const TOTAL_TILES = 25;
const HOUSE_EDGE = 0.05;
let probability = 1;
for (let i = 0; i < picks; i++) {
probability *= (TOTAL_TILES - mines - i) / (TOTAL_TILES - i);
}
if (probability <= 0) return 1.0;
const fairMultiplier = (1 / probability) * (1 - HOUSE_EDGE);
// Backend payout cap logic
const MAX_PAYOUT = 2_000_000;
const HIGH_BET_THRESHOLD = 50_000;
const mineFactor = 1 + (mines / 25);
const baseMultiplier = (1.4 + Math.pow(picks, 0.45)) * mineFactor;
let maxPayout: number;
if (betAmount > HIGH_BET_THRESHOLD) {
const betRatio = Math.pow(Math.min(1, (betAmount - HIGH_BET_THRESHOLD) / (MAX_PAYOUT - HIGH_BET_THRESHOLD)), 1);
const maxAllowedMultiplier = 1.05 + (picks * 0.1);
const highBetMultiplier = Math.min(baseMultiplier, maxAllowedMultiplier) * (1 - (betAmount / MAX_PAYOUT) * 0.9);
const betSizeFactor = Math.max(0.1, 1 - (betAmount / MAX_PAYOUT) * 0.9);
const minMultiplier = (1.1 + (picks * 0.15 * betSizeFactor)) * mineFactor;
const reducedMultiplier = highBetMultiplier - ((highBetMultiplier - minMultiplier) * betRatio);
maxPayout = Math.min(betAmount * reducedMultiplier, MAX_PAYOUT);
} else {
maxPayout = Math.min(betAmount * baseMultiplier, MAX_PAYOUT);
}
const rawPayout = fairMultiplier * betAmount;
const cappedPayout = Math.min(rawPayout, maxPayout);
const effectiveMultiplier = cappedPayout / betAmount;
return Math.max(1.0, Number(effectiveMultiplier.toFixed(2)));
}