Spaces:
Running
Running
| <html lang="fr"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>IVOIRMATH - Apprendre les maths en s'amusant</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <script src="https://cdn.jsdelivr.net/npm/canvas-confetti@1.6.0/dist/confetti.browser.min.js"></script> | |
| <script> | |
| tailwind.config = { | |
| theme: { | |
| extend: { | |
| colors: { | |
| 'ivoire-orange': '#FF8C00', | |
| 'ivoire-green': '#009A49', | |
| 'ivoire-yellow': '#FFD700', | |
| 'ivoire-blue': '#005FAA', | |
| }, | |
| animation: { | |
| 'bounce-slow': 'bounce 2s infinite', | |
| 'tada': 'tada 1s', | |
| 'wobble': 'wobble 1s', | |
| 'jello': 'jello 1s', | |
| } | |
| } | |
| } | |
| } | |
| </script> | |
| <style> | |
| @keyframes bounce { | |
| 0%, 100% { transform: translateY(0); } | |
| 50% { transform: translateY(-15px); } | |
| } | |
| @keyframes tada { | |
| 0% { transform: scale(1); } | |
| 10%, 20% { transform: scale(0.9) rotate(-3deg); } | |
| 30%, 50%, 70%, 90% { transform: scale(1.1) rotate(3deg); } | |
| 40%, 60%, 80% { transform: scale(1.1) rotate(-3deg); } | |
| 100% { transform: scale(1) rotate(0); } | |
| } | |
| @keyframes wobble { | |
| 0% { transform: translateX(0%); } | |
| 15% { transform: translateX(-25%) rotate(-5deg); } | |
| 30% { transform: translateX(20%) rotate(3deg); } | |
| 45% { transform: translateX(-15%) rotate(-3deg); } | |
| 60% { transform: translateX(10%) rotate(2deg); } | |
| 75% { transform: translateX(-5%) rotate(-1deg); } | |
| 100% { transform: translateX(0%); } | |
| } | |
| @keyframes jello { | |
| 0%, 100% { transform: scale3d(1, 1, 1); } | |
| 15% { transform: scale3d(1.25, 0.75, 1); } | |
| 30% { transform: scale3d(0.75, 1.25, 1); } | |
| 45% { transform: scale3d(1.15, 0.85, 1); } | |
| 60% { transform: scale3d(0.95, 1.05, 1); } | |
| 75% { transform: scale3d(1.05, 0.95, 1); } | |
| } | |
| .mascotte { | |
| transition: all 0.3s ease; | |
| } | |
| .operation-box { | |
| transition: all 0.3s ease; | |
| } | |
| .operation-box:hover { | |
| transform: scale(1.05); | |
| box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2); | |
| } | |
| .digitalstrateges-logo { | |
| position: relative; | |
| font-weight: 800; | |
| background: linear-gradient(90deg, #FF8C00, #009A49, #005FAA); | |
| -webkit-background-clip: text; | |
| background-clip: text; | |
| color: transparent; | |
| animation: gradient 5s ease infinite; | |
| background-size: 200% 200%; | |
| } | |
| @keyframes gradient { | |
| 0% { background-position: 0% 50%; } | |
| 50% { background-position: 100% 50%; } | |
| 100% { background-position: 0% 50%; } | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gradient-to-b from-ivoire-green to-ivoire-blue min-h-screen font-sans"> | |
| <div class="container mx-auto px-4 py-8"> | |
| <!-- Header --> | |
| <header class="flex flex-col items-center mb-8"> | |
| <div class="flex items-center justify-center bg-white rounded-full p-4 shadow-lg animate-jello"> | |
| <i class="fas fa-calculator text-ivoire-orange text-4xl mr-3"></i> | |
| <h1 class="text-3xl font-bold text-ivoire-green">IVOIR<span class="text-ivoire-orange">MATH</span></h1> | |
| </div> | |
| <p class="mt-4 text-white text-center text-lg">Apprends les mathématiques en t'amusant !</p> | |
| </header> | |
| <!-- Main Content --> | |
| <main class="bg-white/90 backdrop-blur-sm rounded-3xl shadow-2xl overflow-hidden border-2 border-white/20"> | |
| <!-- Level Selection --> | |
| <section id="level-section" class="p-6"> | |
| <h2 class="text-2xl font-bold text-ivoire-green mb-6 text-center">Choisis ton niveau</h2> | |
| <div class="grid grid-cols-2 md:grid-cols-4 gap-4"> | |
| <button onclick="selectLevel('CP')" class="level-btn bg-gradient-to-br from-ivoire-yellow to-yellow-400 hover:from-yellow-400 hover:to-ivoire-yellow text-white font-bold py-6 px-2 rounded-xl transition-all transform hover:scale-105 shadow-lg"> | |
| <i class="fas fa-star text-2xl mb-2 animate-bounce-slow"></i> | |
| <span class="block">CP</span> | |
| <span class="text-xs font-normal">Nombres 0-20</span> | |
| </button> | |
| <button onclick="selectLevel('CE1')" class="level-btn bg-gradient-to-br from-ivoire-orange to-orange-500 hover:from-orange-500 hover:to-ivoire-orange text-white font-bold py-6 px-2 rounded-xl transition-all transform hover:scale-105 shadow-lg"> | |
| <i class="fas fa-moon text-2xl mb-2 animate-bounce-slow" style="animation-delay: 0.2s"></i> | |
| <span class="block">CE1</span> | |
| <span class="text-xs font-normal">Nombres 0-100</span> | |
| </button> | |
| <button onclick="selectLevel('CE2')" class="level-btn bg-gradient-to-br from-ivoire-green to-green-600 hover:from-green-600 hover:to-ivoire-green text-white font-bold py-6 px-2 rounded-xl transition-all transform hover:scale-105 shadow-lg"> | |
| <i class="fas fa-sun text-2xl mb-2 animate-bounce-slow" style="animation-delay: 0.4s"></i> | |
| <span class="block">CE2</span> | |
| <span class="text-xs font-normal">Multiplications</span> | |
| </button> | |
| <button onclick="selectLevel('CM')" class="level-btn bg-gradient-to-br from-purple-500 to-purple-600 hover:from-purple-600 hover:to-purple-500 text-white font-bold py-6 px-2 rounded-xl transition-all transform hover:scale-105 shadow-lg"> | |
| <i class="fas fa-rocket text-2xl mb-2 animate-bounce-slow" style="animation-delay: 0.6s"></i> | |
| <span class="block">CM</span> | |
| <span class="text-xs font-normal">Division</span> | |
| </button> | |
| </div> | |
| </section> | |
| <!-- Operation Section (hidden initially) --> | |
| <section id="operation-section" class="hidden p-6 bg-gray-50/50"> | |
| <div class="flex justify-between items-center mb-6"> | |
| <button onclick="backToLevels()" class="text-ivoire-orange hover:text-orange-700 font-bold flex items-center"> | |
| <i class="fas fa-arrow-left mr-2"></i>Retour | |
| </button> | |
| <div class="bg-white px-4 py-2 rounded-full shadow-md border border-gray-200"> | |
| <span id="current-level" class="font-bold text-ivoire-green"></span> | |
| <span class="text-gray-500 mx-2">|</span> | |
| <span id="score" class="font-bold">Score: <span class="text-ivoire-orange">0</span></span> | |
| </div> | |
| </div> | |
| <div class="text-center mb-8"> | |
| <div id="mascotte" class="inline-block mascotte"> | |
| <div class="relative"> | |
| <i class="fas fa-robot text-6xl text-ivoire-orange"></i> | |
| <div id="mascotte-face" class="absolute inset-0 flex justify-center items-center"> | |
| <i class="fas fa-smile text-xl text-white"></i> | |
| </div> | |
| </div> | |
| </div> | |
| <p id="message" class="mt-4 text-gray-700 font-medium">Prêt pour un nouveau défi ?</p> | |
| </div> | |
| <div id="operation-container" class="bg-white rounded-xl p-6 shadow-lg mb-6 border-2 border-ivoire-orange/20"> | |
| <div class="text-center text-3xl font-bold mb-4" id="operation-display"></div> | |
| <div class="flex justify-center"> | |
| <input type="number" id="answer-input" class="border-2 border-ivoire-orange rounded-lg px-4 py-3 text-center text-2xl w-40 focus:outline-none focus:ring-2 focus:ring-ivoire-orange focus:border-transparent" placeholder="?" autofocus> | |
| </div> | |
| </div> | |
| <div class="flex justify-center"> | |
| <button onclick="checkAnswer()" class="bg-gradient-to-r from-ivoire-green to-green-600 hover:from-green-600 hover:to-ivoire-green text-white font-bold py-4 px-10 rounded-full text-lg shadow-lg transition-all transform hover:scale-105 active:scale-95"> | |
| Valider <i class="fas fa-check ml-2"></i> | |
| </button> | |
| </div> | |
| <div id="feedback" class="mt-6 hidden"> | |
| <div class="bg-blue-50 border-l-4 border-blue-500 p-4 rounded-lg"> | |
| <div class="flex"> | |
| <div class="flex-shrink-0"> | |
| <i class="fas fa-info-circle text-blue-500 text-xl"></i> | |
| </div> | |
| <div class="ml-3"> | |
| <p id="feedback-text" class="text-sm text-blue-700"></p> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </section> | |
| <!-- Progress Section --> | |
| <section id="progress-section" class="hidden p-6 bg-gray-100/50 border-t border-gray-200"> | |
| <h3 class="text-lg font-bold text-ivoire-green mb-4">Ta progression</h3> | |
| <div class="bg-white rounded-lg p-4 shadow-md"> | |
| <div class="flex justify-between mb-2"> | |
| <span class="text-gray-700">Opérations réussies</span> | |
| <span id="correct-count" class="font-bold text-ivoire-green">0</span> | |
| </div> | |
| <div class="flex justify-between"> | |
| <span class="text-gray-700">Opérations à revoir</span> | |
| <span id="incorrect-count" class="font-bold text-ivoire-orange">0</span> | |
| </div> | |
| <div class="mt-4"> | |
| <div class="w-full bg-gray-200 rounded-full h-4"> | |
| <div id="progress-bar" class="bg-gradient-to-r from-ivoire-green to-green-500 h-4 rounded-full transition-all duration-500" style="width: 0%"></div> | |
| </div> | |
| <div class="text-right mt-1"> | |
| <span id="progress-percent" class="text-xs font-bold text-gray-600">0%</span> | |
| </div> | |
| </div> | |
| </div> | |
| </section> | |
| </main> | |
| <!-- Footer --> | |
| <footer class="mt-8 text-center text-white"> | |
| <div class="mb-4 flex justify-center space-x-3"> | |
| <button onclick="shareOnWhatsApp()" class="bg-green-600 hover:bg-green-700 text-white font-bold py-2 px-4 rounded-full inline-flex items-center transition-all transform hover:scale-105"> | |
| <i class="fab fa-whatsapp mr-2"></i> Partager | |
| </button> | |
| <button onclick="showSupport()" class="bg-gradient-to-r from-ivoire-orange to-orange-600 hover:from-orange-600 hover:to-ivoire-orange text-white font-bold py-2 px-4 rounded-full inline-flex items-center transition-all transform hover:scale-105"> | |
| <i class="fas fa-heart mr-2"></i> Soutenir | |
| </button> | |
| </div> | |
| <p class="text-sm mb-2">© 2023 IVOIRMATH - Conforme au programme ivoirien</p> | |
| <p class="text-xs opacity-80">Créé avec <i class="fas fa-heart text-red-400"></i> par <span class="digitalstrateges-logo">DIGITALSTRATEGES</span></p> | |
| </footer> | |
| </div> | |
| <!-- Support Modal --> | |
| <div id="support-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden z-50"> | |
| <div class="bg-white rounded-lg p-6 max-w-md w-full mx-4 animate-jello"> | |
| <div class="flex justify-between items-center mb-4"> | |
| <h3 class="text-xl font-bold text-ivoire-green">Soutenir IVOIRMATH</h3> | |
| <button onclick="hideSupport()" class="text-gray-500 hover:text-gray-700"> | |
| <i class="fas fa-times"></i> | |
| </button> | |
| </div> | |
| <p class="mb-4">Votre soutien nous aide à améliorer l'application pour tous les enfants !</p> | |
| <div class="bg-yellow-50 border-l-4 border-yellow-400 p-4 mb-4 rounded"> | |
| <div class="flex items-start"> | |
| <div class="flex-shrink-0 pt-1"> | |
| <i class="fas fa-money-bill-wave text-yellow-500 text-xl"></i> | |
| </div> | |
| <div class="ml-3"> | |
| <p class="text-sm font-medium text-yellow-700">Via Wave Mobile Money :</p> | |
| <div class="mt-2 flex items-center"> | |
| <i class="fas fa-mobile-alt text-yellow-500 mr-2"></i> | |
| <span class="font-mono bg-gray-100 px-2 py-1 rounded">+225 07 00 00 00</span> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="bg-blue-50 border-l-4 border-blue-400 p-4 mb-4 rounded"> | |
| <div class="flex items-start"> | |
| <div class="flex-shrink-0 pt-1"> | |
| <i class="fab fa-paypal text-blue-500 text-xl"></i> | |
| </div> | |
| <div class="ml-3"> | |
| <p class="text-sm font-medium text-blue-700">Via PayPal :</p> | |
| <div class="mt-2"> | |
| <a href="https://paypal.me/digitalstrateges" target="_blank" class="text-blue-600 hover:underline">paypal.me/digitalstrateges</a> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <button onclick="hideSupport()" class="w-full bg-gradient-to-r from-ivoire-green to-green-600 hover:from-green-600 hover:to-ivoire-green text-white font-bold py-3 px-4 rounded-lg transition-all transform hover:scale-105"> | |
| Fermer | |
| </button> | |
| </div> | |
| </div> | |
| <script> | |
| // Game state | |
| const gameState = { | |
| level: null, | |
| score: 0, | |
| correctAnswers: 0, | |
| incorrectAnswers: 0, | |
| currentOperation: null, | |
| answer: null, | |
| streak: 0 | |
| }; | |
| // Operation generators for each level | |
| const operationGenerators = { | |
| 'CP': generateCPOperation, | |
| 'CE1': generateCE1Operation, | |
| 'CE2': generateCE2Operation, | |
| 'CM': generateCMOperation | |
| }; | |
| // Select level | |
| function selectLevel(level) { | |
| gameState.level = level; | |
| document.getElementById('current-level').textContent = level; | |
| document.getElementById('level-section').classList.add('hidden'); | |
| document.getElementById('operation-section').classList.remove('hidden'); | |
| document.getElementById('progress-section').classList.remove('hidden'); | |
| generateNewOperation(); | |
| // Animation for transition | |
| const operationSection = document.getElementById('operation-section'); | |
| operationSection.classList.add('animate__animated', 'animate__fadeIn'); | |
| setTimeout(() => { | |
| operationSection.classList.remove('animate__animated', 'animate__fadeIn'); | |
| }, 500); | |
| } | |
| // Back to level selection | |
| function backToLevels() { | |
| document.getElementById('level-section').classList.remove('hidden'); | |
| document.getElementById('operation-section').classList.add('hidden'); | |
| document.getElementById('progress-section').classList.add('hidden'); | |
| document.getElementById('feedback').classList.add('hidden'); | |
| resetGameState(); | |
| // Animation for transition | |
| const levelSection = document.getElementById('level-section'); | |
| levelSection.classList.add('animate__animated', 'animate__fadeIn'); | |
| setTimeout(() => { | |
| levelSection.classList.remove('animate__animated', 'animate__fadeIn'); | |
| }, 500); | |
| } | |
| // Reset game state | |
| function resetGameState() { | |
| gameState.score = 0; | |
| gameState.correctAnswers = 0; | |
| gameState.incorrectAnswers = 0; | |
| gameState.streak = 0; | |
| updateScore(); | |
| } | |
| // Generate new operation based on level | |
| function generateNewOperation() { | |
| gameState.currentOperation = operationGenerators[gameState.level](); | |
| document.getElementById('operation-display').textContent = gameState.currentOperation.display; | |
| document.getElementById('answer-input').value = ''; | |
| document.getElementById('feedback').classList.add('hidden'); | |
| document.getElementById('message').textContent = "Essaie de résoudre cette opération !"; | |
| document.getElementById('answer-input').focus(); | |
| // Reset mascotte animation | |
| const mascotte = document.getElementById('mascotte'); | |
| mascotte.className = 'inline-block mascotte'; | |
| mascotte.classList.add('animate-bounce-slow'); | |
| const face = document.getElementById('mascotte-face'); | |
| face.innerHTML = '<i class="fas fa-smile text-xl text-white"></i>'; | |
| } | |
| // Check user answer | |
| function checkAnswer() { | |
| const userAnswer = parseInt(document.getElementById('answer-input').value); | |
| const feedback = document.getElementById('feedback'); | |
| const feedbackText = document.getElementById('feedback-text'); | |
| const mascotte = document.getElementById('mascotte'); | |
| const face = document.getElementById('mascotte-face'); | |
| if (isNaN(userAnswer)) { | |
| feedbackText.textContent = "Entre un nombre s'il te plaît !"; | |
| feedback.classList.remove('hidden'); | |
| // Mascotte sad face | |
| face.innerHTML = '<i class="fas fa-frown text-xl text-white"></i>'; | |
| mascotte.classList.remove('animate-bounce-slow'); | |
| mascotte.classList.add('animate-wobble'); | |
| return; | |
| } | |
| if (userAnswer === gameState.currentOperation.answer) { | |
| // Correct answer | |
| gameState.score += 10; | |
| gameState.correctAnswers++; | |
| gameState.streak++; | |
| // Bonus for streak | |
| if (gameState.streak >= 3) { | |
| const bonus = Math.floor(gameState.streak / 3) * 5; | |
| gameState.score += bonus; | |
| } | |
| updateScore(); | |
| // Mascotte happy animation | |
| mascotte.className = 'inline-block mascotte'; | |
| mascotte.classList.add('animate-tada'); | |
| face.innerHTML = '<i class="fas fa-smile-beam text-xl text-white"></i>'; | |
| document.getElementById('message').textContent = getSuccessMessage(); | |
| feedbackText.textContent = gameState.currentOperation.explanation || "Excellent travail !"; | |
| if (gameState.streak >= 3) { | |
| feedbackText.textContent += ` (+${Math.floor(gameState.streak / 3) * 5} points bonus pour ta série de ${gameState.streak} bonnes réponses !)`; | |
| } | |
| feedback.classList.remove('hidden'); | |
| // Confetti celebration | |
| confetti({ | |
| particleCount: 100, | |
| spread: 70, | |
| origin: { y: 0.6 }, | |
| colors: ['#FF8C00', '#009A49', '#FFD700', '#005FAA'] | |
| }); | |
| setTimeout(generateNewOperation, 2000); | |
| } else { | |
| // Incorrect answer | |
| gameState.incorrectAnswers++; | |
| gameState.streak = 0; | |
| updateScore(); | |
| // Mascotte sad animation | |
| mascotte.className = 'inline-block mascotte'; | |
| mascotte.classList.add('animate-wobble'); | |
| face.innerHTML = '<i class="fas fa-sad-tear text-xl text-white"></i>'; | |
| document.getElementById('message').textContent = "Presque ! Essaie encore."; | |
| feedbackText.textContent = `La réponse correcte était ${gameState.currentOperation.answer}. ${gameState.currentOperation.explanation || ''}`; | |
| feedback.classList.remove('hidden'); | |
| } | |
| } | |
| // Get random success message | |
| function getSuccessMessage() { | |
| const messages = [ | |
| "Bravo ! C'est parfait !", | |
| "Génial ! Tu es trop fort !", | |
| "Excellent travail !", | |
| "Tu es un champion des maths !", | |
| "Incroyable ! Continue comme ça !", | |
| "Formidable ! Tu progresses vite !" | |
| ]; | |
| return messages[Math.floor(Math.random() * messages.length)]; | |
| } | |
| // Update score display | |
| function updateScore() { | |
| document.getElementById('score').innerHTML = `Score: <span class="text-ivoire-orange">${gameState.score}</span>`; | |
| document.getElementById('correct-count').textContent = gameState.correctAnswers; | |
| document.getElementById('incorrect-count').textContent = gameState.incorrectAnswers; | |
| const total = gameState.correctAnswers + gameState.incorrectAnswers; | |
| const percentage = total > 0 ? Math.round((gameState.correctAnswers / total) * 100) : 0; | |
| document.getElementById('progress-bar').style.width = `${percentage}%`; | |
| document.getElementById('progress-percent').textContent = `${percentage}%`; | |
| } | |
| // Share on WhatsApp | |
| function shareOnWhatsApp() { | |
| const text = `Je viens de marquer ${gameState.score} points sur IVOIRMATH ! Rejoins-moi pour apprendre les maths en s'amusant ! 🚀\n\nCréé par DIGITALSTRATEGES`; | |
| const url = `https://wa.me/?text=${encodeURIComponent(text)}`; | |
| window.open(url, '_blank'); | |
| } | |
| // Show support modal | |
| function showSupport() { | |
| document.getElementById('support-modal').classList.remove('hidden'); | |
| } | |
| // Hide support modal | |
| function hideSupport() { | |
| document.getElementById('support-modal').classList.add('hidden'); | |
| } | |
| // Operation generators | |
| function generateCPOperation() { | |
| const num1 = Math.floor(Math.random() * 20); | |
| const num2 = Math.floor(Math.random() * 20); | |
| const operations = ['+', '-']; | |
| const operation = operations[Math.floor(Math.random() * operations.length)]; | |
| let answer, display, explanation; | |
| if (operation === '+') { | |
| answer = num1 + num2; | |
| display = `${num1} + ${num2} = ?`; | |
| explanation = `Addition : ${num1} + ${num2} = ${answer}`; | |
| } else { | |
| // Ensure positive result for CP level | |
| const larger = Math.max(num1, num2); | |
| const smaller = Math.min(num1, num2); | |
| answer = larger - smaller; | |
| display = `${larger} - ${smaller} = ?`; | |
| explanation = `Soustraction : ${larger} - ${smaller} = ${answer}`; | |
| } | |
| return { display, answer, explanation }; | |
| } | |
| function generateCE1Operation() { | |
| const num1 = Math.floor(Math.random() * 10); | |
| const num2 = Math.floor(Math.random() * 10); | |
| const operations = ['+', '-', '×']; | |
| const operation = operations[Math.floor(Math.random() * operations.length)]; | |
| let answer, display, explanation; | |
| if (operation === '+') { | |
| answer = num1 + num2; | |
| display = `${num1} + ${num2} = ?`; | |
| explanation = `Addition : ${num1} + ${num2} = ${answer}`; | |
| } else if (operation === '-') { | |
| const larger = Math.max(num1, num2); | |
| const smaller = Math.min(num1, num2); | |
| answer = larger - smaller; | |
| display = `${larger} - ${smaller} = ?`; | |
| explanation = `Soustraction : ${larger} - ${smaller} = ${answer}`; | |
| } else { | |
| answer = num1 * num2; | |
| display = `${num1} × ${num2} = ?`; | |
| explanation = `Multiplication : ${num1} × ${num2} = ${answer}`; | |
| } | |
| return { display, answer, explanation }; | |
| } | |
| function generateCE2Operation() { | |
| const operations = ['+', '-', '×', '÷']; | |
| const operation = operations[Math.floor(Math.random() * operations.length)]; | |
| let answer, display, explanation; | |
| if (operation === '+' || operation === '-') { | |
| const num1 = Math.floor(Math.random() * 50); | |
| const num2 = Math.floor(Math.random() * 50); | |
| if (operation === '+') { | |
| answer = num1 + num2; | |
| display = `${num1} + ${num2} = ?`; | |
| explanation = `Addition : ${num1} + ${num2} = ${answer}`; | |
| } else { | |
| const larger = Math.max(num1, num2); | |
| const smaller = Math.min(num1, num2); | |
| answer = larger - smaller; | |
| display = `${larger} - ${smaller} = ?`; | |
| explanation = `Soustraction : ${larger} - ${smaller} = ${answer}`; | |
| } | |
| } else if (operation === '×') { | |
| const num1 = Math.floor(Math.random() * 12) + 1; | |
| const num2 = Math.floor(Math.random() * 12) + 1; | |
| answer = num1 * num2; | |
| display = `${num1} × ${num2} = ?`; | |
| explanation = `Multiplication : ${num1} × ${num2} = ${answer}`; | |
| } else { | |
| // Division with whole number results | |
| const num2 = Math.floor(Math.random() * 10) + 1; | |
| const answer = Math.floor(Math.random() * 10) + 1; | |
| const num1 = num2 * answer; | |
| display = `${num1} ÷ ${num2} = ?`; | |
| explanation = `Division : ${num1} ÷ ${num2} = ${answer} (car ${num2} × ${answer} = ${num1})`; | |
| } | |
| return { display, answer, explanation }; | |
| } | |
| function generateCMOperation() { | |
| const operations = ['+', '-', '×', '÷']; | |
| const operation = operations[Math.floor(Math.random() * operations.length)]; | |
| let answer, display, explanation; | |
| if (operation === '+' || operation === '-') { | |
| const num1 = Math.floor(Math.random() * 100); | |
| const num2 = Math.floor(Math.random() * 100); | |
| if (operation === '+') { | |
| answer = num1 + num2; | |
| display = `${num1} + ${num2} = ?`; | |
| explanation = `Addition : ${num1} + ${num2} = ${answer}`; | |
| } else { | |
| const larger = Math.max(num1, num2); | |
| const smaller = Math.min(num1, num2); | |
| answer = larger - smaller; | |
| display = `${larger} - ${smaller} = ?`; | |
| explanation = `Soustraction : ${larger} - ${smaller} = ${answer}`; | |
| } | |
| } else if (operation === '×') { | |
| const num1 = Math.floor(Math.random() * 15) + 1; | |
| const num2 = Math.floor(Math.random() * 15) + 1; | |
| answer = num1 * num2; | |
| display = `${num1} × ${num2} = ?`; | |
| explanation = `Multiplication : ${num1} × ${num2} = ${answer}`; | |
| } else { | |
| // Division with possible remainders | |
| const num2 = Math.floor(Math.random() * 12) + 1; | |
| const num1 = Math.floor(Math.random() * 10) * num2; | |
| answer = num1 / num2; | |
| display = `${num1} ÷ ${num2} = ?`; | |
| explanation = `Division : ${num1} ÷ ${num2} = ${answer}`; | |
| } | |
| return { display, answer, explanation }; | |
| } | |
| // Handle Enter key in answer input | |
| document.getElementById('answer-input').addEventListener('keypress', function(e) { | |
| if (e.key === 'Enter') { | |
| checkAnswer(); | |
| } | |
| }); | |
| </script> | |
| <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=monsieurCisse1er/ivoirmath" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |