jQuery(document).ready(function($) { class AdvancedRoulettePredictor { constructor() { this.numberHistory = []; this.directionHistory = []; this.predictionHistory = []; this.actualResults = []; this.wheelLayout = this.createWheelLayout(); this.sectionDefinitions = this.createSectionDefinitions(); this.modelWeights = this.initializeModel(); this.baseLearningRate = 0.1; this.consecutiveFailures = 0; // 0: Normal Mode, 1: Reverse Strategy Mode, 2: Ultimate Mode this.ultimateModeFailures = 0; // Ultimate Mod için ardışık hata sayacı this.performanceHistory = []; this.physicsParams = { baseSpeed: 30, friction: 0.12, airResistance: 0.04, wheelTilt: 0.08, bounceFactor: 0.25, dealerBias: 0.15 }; this.minChaos = 0.8; this.maxChaos = 2.0; } createWheelLayout() { const numbers = [0, 32, 15, 19, 4, 21, 2, 25, 17, 34, 6, 27, 13, 36, 11, 30, 8, 23, 10, 5, 24, 16, 33, 1, 20, 14, 31, 9, 22, 18, 29, 7, 28, 12, 35, 3, 26]; const colors = ['green', 'red', 'black', 'red', 'black', 'red', 'black', 'red', 'black', 'red', 'black', 'red', 'black', 'red', 'black', 'red', 'black', 'red', 'black', 'red', 'black', 'red', 'black', 'red', 'black', 'red', 'black', 'red', 'black', 'red', 'black', 'red', 'black', 'red', 'black', 'red', 'black']; return numbers.map((num, i) => ({ number: num, color: colors[i], position: i, isEven: num !== 0 && num % 2 === 0, isOdd: num % 2 === 1 })); } createSectionDefinitions() { return { voisins: [0, 2, 3, 4, 7, 12, 15, 18, 19, 21, 22, 25, 26, 28, 29, 32, 35], orphelins: [1, 6, 9, 14, 17, 20, 31, 34], tiers: [5, 8, 10, 11, 13, 16, 23, 24, 27, 30, 33, 36], zero: [0, 12, 35, 3, 26, 32, 15], reds: [32, 19, 21, 25, 34, 27, 36, 30, 23, 5, 16, 1, 14, 9, 18, 7, 12, 3], blacks: [15, 4, 2, 17, 6, 13, 11, 8, 10, 24, 33, 20, 31, 22, 29, 28, 35, 26] }; } initializeModel() { return { dealerPattern: 2.0, sectionPattern: 1.2, physicsModel: 2.0, distancePattern: 1.4, temporalPattern: 1.6, chaoticFactor: 1.5, clusterPattern: 1.5, colorPattern: 1.2, evenOddPattern: 1.1, lstmPattern: 1.3, crowdPattern: 1.8, recentNeighbors: 3.0 }; } getDynamicLearningRate() { return Math.min(0.5, this.baseLearningRate + (this.consecutiveFailures * 0.05)); } getRandomChaosFactor() { return this.minChaos + Math.random() * (this.maxChaos - this.minChaos); } getModeName() { return this.consecutiveFailures === 0 ? 'Normal Mod' : this.consecutiveFailures === 1 ? 'Ters Strateji Modu' : 'Ultimate Mod'; } async calculatePredictions(numbers, directions) { this.numberHistory = numbers; this.directionHistory = directions; if (numbers.length < 5) { return this.getBalancedPredictions(12); } const randomChaos = this.getRandomChaosFactor(); if (this.consecutiveFailures === 2) { console.log('Operating in Ultimate Mode'); return await this.calculateUltimateModePredictions(numbers, directions, randomChaos); } const methods = { dealerPattern: this.analyzeDealerPattern(randomChaos), sectionPattern: this.analyzeSectionPattern(randomChaos), physicsModel: this.physicsBasedPrediction(randomChaos), distancePattern: this.analyzeDistancePattern(randomChaos), temporalPattern: this.analyzeTemporalPattern(randomChaos), chaoticNumbers: this.getChaoticNumbers(4, randomChaos), clusterPattern: this.analyzeClusterPattern(randomChaos), colorPattern: this.analyzeColorPattern(randomChaos), evenOddPattern: this.analyzeEvenOddPattern(randomChaos), lstmPattern: this.analyzeLSTM(randomChaos), crowdPattern: [], recentNeighbors: this.analyzeRecentNeighbors(randomChaos) }; try { methods.crowdPattern = this.analyzeCrowdBehavior(randomChaos); } catch (error) { console.error('Error in analyzeCrowdBehavior:', error); methods.crowdPattern = this.getBalancedPredictions(6).map(p => ({ ...p, methods: ['crowdPattern'], weight: this.modelWeights.crowdPattern * randomChaos })); } const weightedPredictions = this.combinePredictions(methods); const topPredictions = this.getTopPredictions(weightedPredictions, 20); const normalPredictions = this.selectByProbabilityDistribution(topPredictions); const predictionsWithConfidence = this.calculateConfidenceScores(normalPredictions); if (this.consecutiveFailures === 1) { console.log('Operating in Reverse Strategy Mode'); const failedNumbers = predictionsWithConfidence.map(p => p.number); const allNumbers = this.wheelLayout.map(n => n.number); const availableNumbers = allNumbers.filter(n => !failedNumbers.includes(n)); const reversePredictions = this.generateReverseStrategyPredictions(availableNumbers, randomChaos); const balancedReversePredictions = this.selectByProbabilityDistribution(reversePredictions); const reversePredictionsWithConfidence = this.calculateConfidenceScores(balancedReversePredictions); this.predictionHistory.push({ predictions: reversePredictionsWithConfidence, timestamp: Date.now(), methodsUsed: ['reverseStrategy', ...Object.keys(methods)], chaosFactor: randomChaos }); return reversePredictionsWithConfidence; } console.log('Operating in Normal Mode'); this.predictionHistory.push({ predictions: predictionsWithConfidence, timestamp: Date.now(), methodsUsed: Object.keys(methods), chaosFactor: randomChaos }); return predictionsWithConfidence; } async calculateUltimateModePredictions(numbers, directions, randomChaos) { // Normal Mod tahminlerini al this.consecutiveFailures = 0; const normalPredictions = await this.calculatePredictions(numbers, directions); // Ters Strateji Modu tahminlerini al this.consecutiveFailures = 1; const reversePredictions = await this.calculatePredictions(numbers, directions); // Modu tekrar Ultimate'e ayarla this.consecutiveFailures = 2; // Normal Mod'dan 6 sayı seç (en yüksek güvenilirlikle) const selectedFromNormal = [...normalPredictions] .sort((a, b) => b.confidence - a.confidence) .slice(0, 6); // Ters Mod'dan 3 sayı seç (en yüksek güvenilirlikle) const selectedFromReverse = [...reversePredictions] .sort((a, b) => b.confidence - a.confidence) .slice(0, 3); // Eleme listesi oluştur (Normal ve Ters moddaki tüm sayılar) const excludedNumbers = new Set([ ...normalPredictions.map(p => p.number), ...reversePredictions.map(p => p.number) ]); // Kalan sayılar (37 - 24 = 13 sayı) const allNumbers = Array.from({length: 37}, (_, i) => i); const remainingNumbers = allNumbers.filter(num => !excludedNumbers.has(num)); // Kalan 13 sayıdan 7 tanesini rastgele seç const shuffled = [...remainingNumbers].sort(() => 0.5 - Math.random()); const selectedFromRemaining = shuffled.slice(0, 7).map(num => ({ number: num, methods: ['ultimateRemaining'], confidence: Math.floor(Math.random() * 30) + 10, // 10-40% arası rastgele güven weight: 0.3 // Sabit ağırlık })); // Tüm seçimleri birleştir (6 + 3 + 7 = 16 sayı) const ultimatePredictions = [ ...selectedFromNormal.map(p => ({...p, methods: [...p.methods, 'ultimateNormal']})), ...selectedFromReverse.map(p => ({...p, methods: [...p.methods, 'ultimateReverse']})), ...selectedFromRemaining ]; // Geçmişe kaydet this.predictionHistory.push({ predictions: ultimatePredictions, timestamp: Date.now(), methodsUsed: ['ultimateMode'], chaosFactor: randomChaos }); return ultimatePredictions; } selectByProbabilityDistribution(predictions) { const sortedPredictions = [...predictions].sort((a, b) => b.weight - a.weight); const usedNumbers = new Set(); const selected = []; if (sortedPredictions[0] && !usedNumbers.has(sortedPredictions[0].number)) { selected.push(sortedPredictions[0]); usedNumbers.add(sortedPredictions[0].number); } const midStart = Math.floor(sortedPredictions.length * 0.25); const midEnd = Math.floor(sortedPredictions.length * 0.5); let midCount = 0; for (let i = midStart; i < midEnd && midCount < 2; i++) { if (!usedNumbers.has(sortedPredictions[i].number)) { selected.push(sortedPredictions[i]); usedNumbers.add(sortedPredictions[i].number); midCount++; } } const lowStart = Math.floor(sortedPredictions.length * 0.75); let lowCount = 0; for (let i = lowStart; i < sortedPredictions.length && lowCount < 4; i++) { if (!usedNumbers.has(sortedPredictions[i].number)) { selected.push(sortedPredictions[i]); usedNumbers.add(sortedPredictions[i].number); lowCount++; } } let avgCount = 0; for (let i = midStart; i < sortedPredictions.length && avgCount < 5; i++) { if (!usedNumbers.has(sortedPredictions[i].number)) { selected.push(sortedPredictions[i]); usedNumbers.add(sortedPredictions[i].number); avgCount++; } } if (selected.length < 12) { const remaining = this.getBalancedPredictions(12 - selected.length, usedNumbers); selected.push(...remaining); } return selected.slice(0, 12); } generateReverseStrategyPredictions(availableNumbers, randomChaos) { const predictions = [ ...this.physicsBasedPrediction(randomChaos), ...this.getColdNumbers(5, 30, randomChaos), ...this.getColorBalancedNumbers(4, randomChaos), ...this.getEvenOddBalancedNumbers(4, randomChaos), ...this.getOppositeNumbers(this.numberHistory[this.numberHistory.length - 1] || 0, this.directionHistory[this.directionHistory.length - 1] || 'right', randomChaos), ...this.analyzeDealerPattern(randomChaos), ...this.analyzeCrowdBehavior(randomChaos), ...this.analyzeRecentNeighbors(randomChaos) ].filter(p => availableNumbers.includes(p.number)) .map(p => ({ ...p, methods: p.methods.concat(['reverseStrategy']) })); predictions.forEach(p => { p.weight = p.weight || 1; p.weight *= this.calculateChaos() * randomChaos; }); return predictions; } analyzeRecentNeighbors(randomChaos) { const recentNumbers = this.numberHistory.slice(-4, -1); if (recentNumbers.length < 3) return this.getBalancedPredictions(6); const neighborPredictions = []; recentNumbers.forEach((num, index) => { const position = this.wheelLayout.find(n => n.number === num)?.position || 0; const direction = this.directionHistory[this.numberHistory.length - 4 + index] || 'right'; const lagFactor = 0.5 + (2 - index) * 0.25; const offsets = direction === 'right' ? [-3, -2, -1, 1, 2, 3] : [-3, -2, -1, 1, 2, 3]; offsets.forEach(offset => { const neighborPos = (position + offset + this.wheelLayout.length) % this.wheelLayout.length; const neighborNum = this.wheelLayout[neighborPos].number; neighborPredictions.push({ number: neighborNum, methods: ['recentNeighbors'], weight: this.modelWeights.recentNeighbors * lagFactor * (1 + Math.abs(offset) * 0.15) * this.calculateChaos() * randomChaos }); }); }); const combined = {}; neighborPredictions.forEach(pred => { combined[pred.number] = (combined[pred.number] || 0) + pred.weight; }); return Object.entries(combined) .map(([num, weight]) => ({ number: parseInt(num), methods: ['recentNeighbors'], weight: weight })) .sort((a, b) => b.weight - a.weight) .slice(0, 6); } physicsBasedPrediction(randomChaos) { const simulations = this.simulateWheel(this.physicsParams.baseSpeed, this.physicsParams.wheelTilt, this.physicsParams.dealerBias); const frequency = {}; simulations.forEach(num => { frequency[num] = (frequency[num] || 0) + 1; }); return Object.entries(frequency) .sort((a, b) => b[1] - a[1]) .slice(0, 6) .map(entry => ({ number: parseInt(entry[0]), methods: ['physicsModel'], weight: this.modelWeights.physicsModel * (entry[1] / 1000) * this.calculateChaos() * randomChaos * 1.5 })); } simulateWheel(ballSpeed, wheelTilt, dealerBias) { const results = []; for (let i = 0; i < 1000; i++) { const adjustedSpeed = ballSpeed * (1 + (Math.random() - 0.5) * 0.2); const tiltEffect = wheelTilt * (Math.random() - 0.5); const biasEffect = dealerBias * Math.random(); const finalPos = Math.floor((adjustedSpeed + tiltEffect + biasEffect) % this.wheelLayout.length); results.push(this.wheelLayout[finalPos].number); } return results; } analyzeDealerPattern(randomChaos) { const recentSpins = this.numberHistory.slice(-4); const sectionHits = {}; Object.entries(this.sectionDefinitions).forEach(([section, numbers]) => { sectionHits[section] = recentSpins.filter(num => numbers.includes(num)).length; }); const dominantSection = Object.entries(sectionHits).reduce((a, b) => a[1] > b[1] ? a : b, ['none', 0])[0]; if (sectionHits[dominantSection] >= 3) { return this.sectionDefinitions[dominantSection].slice(0, 6).map(num => ({ number: num, methods: ['dealerPattern'], weight: this.modelWeights.dealerPattern * 2.0 * this.calculateChaos() * randomChaos })); } return this.getBalancedPredictions(6).map(p => ({ ...p, methods: ['dealerPattern'], weight: this.modelWeights.dealerPattern * randomChaos })); } analyzeCrowdBehavior(randomChaos) { const recentBets = this.getSimulatedCrowdBets(); if (!Array.isArray(recentBets) || recentBets.length === 0) { console.warn('recentBets is not an array or is empty, returning balanced predictions'); return this.getBalancedPredictions(6).map(p => ({ ...p, methods: ['crowdPattern'], weight: this.modelWeights.crowdPattern * randomChaos })); } const redCount = recentBets.filter(bet => this.sectionDefinitions.reds.includes(bet)).length; const blackCount = recentBets.filter(bet => this.sectionDefinitions.blacks.includes(bet)).length; const targetColor = redCount > blackCount ? 'blacks' : 'reds'; const candidates = this.sectionDefinitions[targetColor] || this.wheelLayout.map(n => n.number); if (!Array.isArray(candidates)) { console.warn('candidates is not an array, returning balanced predictions'); return this.getBalancedPredictions(6).map(p => ({ ...p, methods: ['crowdPattern'], weight: this.modelWeights.crowdPattern * randomChaos })); } return candidates.slice(0, 6).map(num => ({ number: num, methods: ['crowdPattern'], weight: this.modelWeights.crowdPattern * (0.5 + Math.abs(redCount - blackCount) * 0.3) * this.calculateChaos() * randomChaos })); } getSimulatedCrowdBets() { if (!this.wheelLayout || !Array.isArray(this.wheelLayout) || this.wheelLayout.length === 0) { console.warn('wheelLayout is not properly initialized, generating random numbers'); return Array.from({ length: 20 }, () => Math.floor(Math.random() * 37)); } return Array.from({ length: 20 }, () => this.wheelLayout[Math.floor(Math.random() * this.wheelLayout.length)].number); } analyzeLSTM(randomChaos) { return this.getBalancedPredictions(5).map(p => ({ ...p, methods: ['lstmPattern'], weight: this.modelWeights.lstmPattern * randomChaos })); } calculateChaos() { const recentSpins = this.numberHistory.slice(-20); if (recentSpins.length < 2) return 1.2; const mean = recentSpins.reduce((sum, num) => sum + num, 0) / recentSpins.length; const variance = recentSpins.reduce((sum, num) => sum + Math.pow(num - mean, 2), 0) / recentSpins.length; const stdDev = Math.sqrt(variance); const entropy = this.calculateEntropy(recentSpins); return Math.min(2.0, (stdDev / 10 + entropy)); } calculateEntropy(numbers) { const frequency = {}; numbers.forEach(num => { frequency[num] = (frequency[num] || 0) + 1; }); return -Object.values(frequency) .map(f => f / numbers.length) .reduce((sum, p) => sum + p * Math.log2(p), 0) || 1.0; } analyzeSectionPattern(randomChaos) { return this.getBalancedPredictions(5).map(p => ({ ...p, methods: ['sectionPattern'], weight: this.modelWeights.sectionPattern * randomChaos })); } analyzeDistancePattern(randomChaos) { return this.getBalancedPredictions(5).map(p => ({ ...p, methods: ['distancePattern'], weight: this.modelWeights.distancePattern * randomChaos })); } analyzeTemporalPattern(randomChaos) { return this.getBalancedPredictions(5).map(p => ({ ...p, methods: ['temporalPattern'], weight: this.modelWeights.temporalPattern * randomChaos })); } getChaoticNumbers(count, randomChaos) { return this.getBalancedPredictions(count).map(p => ({ ...p, methods: ['chaoticNumbers'], weight: this.calculateChaos() * 2.0 * randomChaos })); } analyzeClusterPattern(randomChaos) { return this.getBalancedPredictions(5).map(p => ({ ...p, methods: ['clusterPattern'], weight: this.modelWeights.clusterPattern * randomChaos })); } analyzeColorPattern(randomChaos) { return this.getBalancedPredictions(5).map(p => ({ ...p, methods: ['colorPattern'], weight: this.modelWeights.colorPattern * randomChaos })); } analyzeEvenOddPattern(randomChaos) { return this.getBalancedPredictions(5).map(p => ({ ...p, methods: ['evenOddPattern'], weight: this.modelWeights.evenOddPattern * randomChaos })); } getOppositeNumbers(number, direction, randomChaos) { const currentPos = this.wheelLayout.find(n => n.number === number)?.position || 0; const offset = direction === 'right' ? 10 : -10; const newPos = (currentPos + offset + this.wheelLayout.length) % this.wheelLayout.length; return [{ number: this.wheelLayout[newPos].number, methods: ['oppositeNumbers'], weight: this.modelWeights.chaoticFactor * 1.5 * this.calculateChaos() * randomChaos }]; } combinePredictions(methods) { return Object.values(methods).flat().filter(p => p && p.number !== undefined); } getTopPredictions(predictions, count) { return predictions.sort((a, b) => (b.weight || 0) - (a.weight || 0)).slice(0, count); } calculateConfidenceScores(predictions) { const maxWeight = Math.max(...predictions.map(p => p.weight || 0)) || 1; return predictions.map(p => ({ ...p, confidence: Math.min(100, Math.round((p.weight / maxWeight) * 100)) })); } getBalancedPredictions(count, excludeNumbers = new Set()) { if (!this.wheelLayout || !Array.isArray(this.wheelLayout) || this.wheelLayout.length === 0) { console.warn('wheelLayout is not properly initialized, generating random numbers'); return Array.from({ length: count }, () => ({ number: Math.floor(Math.random() * 37), methods: ['balanced'], weight: this.calculateChaos() * 1.2 })); } const availableNumbers = this.wheelLayout .map(n => n.number) .filter(n => !excludeNumbers.has(n)); const step = Math.max(1, Math.floor(availableNumbers.length / count)); const predictions = []; for (let i = 0; i < count && i < availableNumbers.length; i++) { const idx = (i * step) % availableNumbers.length; predictions.push({ number: availableNumbers[idx], methods: ['balanced'], weight: this.calculateChaos() * 1.2 }); } return predictions; } getColdNumbers(count, lookback = 20, randomChaos) { const recentNumbers = this.numberHistory.slice(-lookback); const frequencyMap = {}; recentNumbers.forEach(num => { frequencyMap[num] = (frequencyMap[num] || 0) + 1; }); const availableNumbers = this.wheelLayout .map(n => n.number) .filter(n => !recentNumbers.includes(n) || frequencyMap[n] === 1); const shuffled = [...availableNumbers].sort(() => 0.5 - Math.random()); return shuffled.slice(0, count).map(num => { const repeatPenalty = frequencyMap[num] > 1 ? 0.1 : 1.0; return { number: num, methods: ['coldNumbers'], weight: this.modelWeights.chaoticFactor * 1.5 * this.calculateChaos() * repeatPenalty * randomChaos }; }); } getColorBalancedNumbers(count, randomChaos) { const lastRed = this.numberHistory.slice().reverse().find(n => this.sectionDefinitions.reds?.includes(n)); const lastBlack = this.numberHistory.slice().reverse().find(n => this.sectionDefinitions.blacks?.includes(n)); const predictions = []; if (lastRed && lastBlack && this.sectionDefinitions.reds && this.sectionDefinitions.blacks) { const redCount = this.numberHistory.slice(-10).filter(n => this.sectionDefinitions.reds.includes(n)).length; const blackCount = this.numberHistory.slice(-10).filter(n => this.sectionDefinitions.blacks.includes(n)).length; const targetColor = redCount > blackCount ? 'blacks' : 'reds'; const candidates = this.sectionDefinitions[targetColor] || this.wheelLayout.map(n => n.number); if (!Array.isArray(candidates)) { console.warn('candidates is not an array in getColorBalancedNumbers, returning balanced predictions'); return this.getBalancedPredictions(count).map(p => ({ ...p, methods: ['colorBalance'], weight: this.modelWeights.colorPattern * randomChaos })); } const shuffled = [...candidates].sort(() => 0.5 - Math.random()); predictions.push(...shuffled.slice(0, Math.ceil(count/2)).map(num => ({ number: num, methods: ['colorBalance'], weight: this.modelWeights.colorPattern * (0.5 + Math.abs(redCount - blackCount) * 0.3) * this.calculateChaos() * randomChaos }))); } return predictions.length ? predictions : this.getBalancedPredictions(count).map(p => ({ ...p, methods: ['colorBalance'], weight: this.modelWeights.colorPattern * randomChaos })); } getEvenOddBalancedNumbers(count, randomChaos) { const evenCount = this.numberHistory.slice(-10).filter(n => n !== 0 && n % 2 === 0).length; const oddCount = this.numberHistory.slice(-10).filter(n => n % 2 === 1).length; const targetType = evenCount > oddCount ? 'odd' : 'even'; const candidates = targetType === 'even' ? this.wheelLayout.filter(n => n.isEven).map(n => n.number) : this.wheelLayout.filter(n => n.isOdd).map(n => n.number); const shuffled = [...candidates].sort(() => 0.5 - Math.random()); return shuffled.slice(0, Math.ceil(count/2)).map(num => ({ number: num, methods: ['evenOddBalance'], weight: this.modelWeights.evenOddPattern * (0.6 + Math.abs(evenCount - oddCount) * 0.3) * this.calculateChaos() * randomChaos })); } addActualResult(actualNumber, actualDirection) { if (actualNumber >= 0 && actualNumber <= 36 && actualDirection && ['right', 'left'].includes(actualDirection)) { const lastPrediction = this.predictionHistory[this.predictionHistory.length - 1]; const wasCorrect = lastPrediction?.predictions?.some(p => p.number === actualNumber) || false; this.actualResults.push({ actual: actualNumber, direction: actualDirection, predictions: lastPrediction?.predictions || [], wasCorrect: wasCorrect, timestamp: Date.now() }); console.log(`Added actual result: number=${actualNumber}, direction=${actualDirection}, wasCorrect=${wasCorrect}`); if (this.actualResults.length > 100) { this.actualResults.shift(); } this.numberHistory.push(actualNumber); this.directionHistory.push(actualDirection); if (this.numberHistory.length > 50) { this.numberHistory.shift(); this.directionHistory.shift(); } this.adaptModelWeights(); return true; } console.error(`Invalid actual result: number=${actualNumber}, direction=${actualDirection}`); return false; } adaptModelWeights() { const recentResults = this.actualResults.slice(-15); if (recentResults.length === 0) return; let totalSuccess = 0; const methodPerformance = {}; recentResults.forEach(result => { if (result.wasCorrect) { totalSuccess++; } result.predictions.forEach(pred => { const isCorrect = pred.number === result.actual; pred.methods.forEach(method => { if (!methodPerformance[method]) { methodPerformance[method] = { hits: 0, tries: 0 }; } methodPerformance[method].tries++; if (isCorrect) { methodPerformance[method].hits++; } }); }); }); const lastThreeResults = this.actualResults.slice(-3); const lastThreeFailures = lastThreeResults.filter(r => !r.wasCorrect).length; if (lastThreeFailures >= 3) { if (this.consecutiveFailures === 0) { this.consecutiveFailures = 1; // Normal -> Ters } else if (this.consecutiveFailures === 1) { this.consecutiveFailures = 2; // Ters -> Ultimate } else if (this.consecutiveFailures === 2) { this.consecutiveFailures = 0; // Ultimate -> Normal this.ultimateModeFailures = 0; // Sıfırla } console.log(`Mod değişikliği: Yeni Mod = ${this.getModeName()}`); } if (this.consecutiveFailures === 2 && lastThreeFailures >= 3) { this.ultimateModeFailures++; if (this.ultimateModeFailures >= 3) { this.consecutiveFailures = 0; // Ultimate'den Normal'e dön this.ultimateModeFailures = 0; console.log("Ultimate Mod 3 başarısızlık! Normal Mod'a geçiliyor"); } } console.log(`adaptModelWeights: son 3 tahmin başarısızlık=${lastThreeFailures}, mod=${this.getModeName()}`); const learningRate = this.getDynamicLearningRate(); Object.keys(this.modelWeights).forEach(method => { const perf = methodPerformance[method] || { hits: 0, tries: 1 }; const successRate = perf.hits / perf.tries; const currentWeight = this.modelWeights[method]; if (perf.tries > 3) { if (successRate > 0.25) { const boost = 1 + (successRate - 0.25) * learningRate * 2; this.modelWeights[method] = Math.min(3.0, currentWeight * boost); } else { const penalty = 1 - (0.25 - successRate) * learningRate; this.modelWeights[method] = Math.max(0.5, currentWeight * penalty); } } }); this.performanceHistory.push({ timestamp: Date.now(), weights: { ...this.modelWeights }, successRate: totalSuccess / recentResults.length, consecutiveFailures: this.consecutiveFailures }); if (this.performanceHistory.length > 50) { this.performanceHistory.shift(); } } } // UI Functions const predictor = new AdvancedRoulettePredictor(); let history = Array(10).fill().map(() => ({ number: null, direction: '' })); function initInputs() { const isWordPress = typeof rouletteVars !== 'undefined' && rouletteVars.ajaxurl; if (isWordPress) { const savedHistory = JSON.parse(localStorage.getItem('roulette_history_data')) || []; $('.form-row').each(function(index) { const numberInput = $(this).find('.form-input[type="number"]'); const directionSelect = $(this).find('.form-select'); const numberVal = numberInput.val(); const directionVal = directionSelect.val(); if (numberVal !== '' && !isNaN(numberVal) && numberVal >= 0 && numberVal <= 36 && directionVal) { history[index] = { number: parseInt(numberVal), direction: directionVal }; } else { history[index] = { number: null, direction: '' }; } }); if (savedHistory.length > 0) { history = [...savedHistory, ...history.slice(savedHistory.length)].slice(0, 10); } updateInputFields(); } else { history = JSON.parse(localStorage.getItem('roulette_history_data')) || Array(10).fill().map(() => ({ number: null, direction: '' })); let html = ''; for (let i = 0; i < 10; i++) { const numberValue = (history[i]?.number === 0 || history[i]?.number) ? history[i].number : ''; const directionValue = history[i]?.direction || ''; html += `
Ortalama Güven: ${Math.round(avgConfidence)}%
Model Durumu: ${predictor.getModeName()}
Analiz ediliyor...
'); try { const numbers = history.filter(h => h.number !== null).map(h => h.number); const directions = history.filter(h => h.number !== null).map(h => h.direction); const predictions = await predictor.calculatePredictions(numbers, directions); saveHistory(); displayPredictions(predictions); updateInputFields(); } catch (error) { console.error('Tahmin hatası:', error); $('#predictions').html(' '); } } else { $('#predictions').html(' '); } }); $('#new-number-form').submit(async function(e) { e.preventDefault(); const numberInput = $('#new-number'); const directionSelect = $('#new-direction'); const numberVal = numberInput.val(); if (numberVal !== '' && !isNaN(numberVal) && numberVal >= 0 && numberVal <= 36 && directionSelect.val()) { const number = parseInt(numberVal); if (predictor.addActualResult(number, directionSelect.val())) { history.shift(); history.push({ number, direction: directionSelect.val() }); $('#predictions').html('Analiz ediliyor...
'); try { const numbers = history.filter(h => h.number !== null).map(h => h.number); const directions = history.filter(h => h.number !== null).map(h => h.direction); const predictions = await predictor.calculatePredictions(numbers, directions); saveHistory(); displayPredictions(predictions); updateInputFields(); numberInput.val(''); directionSelect.val(''); } catch (error) { console.error('Yeni spin ekleme hatası:', error); $('#predictions').html(' '); } } else { $('#predictions').html(' '); } } else { $('#predictions').html(' '); } }); initInputs(); addClearButton(); });