diff --git a/MathHomeworkHelper/app/src/main/assets/script.js b/MathHomeworkHelper/app/src/main/assets/script.js index 01e1941..08227fb 100644 --- a/MathHomeworkHelper/app/src/main/assets/script.js +++ b/MathHomeworkHelper/app/src/main/assets/script.js @@ -448,8 +448,8 @@ function handleSubmitAnswer() { showFeedback('🎉 Correct! +1 point', 'correct'); updateScore(); - // Check if reached 20 points - if (gameState.points >= 20) { + // Check if reached 10 points + if (gameState.points >= 10) { showVictoryModal(); return; } @@ -502,7 +502,7 @@ function clearFeedback() { * Update score display */ function updateScore() { - pointsScoreDisplay.textContent = `${gameState.points}/20`; + pointsScoreDisplay.textContent = `${gameState.points}/10`; } /** @@ -643,7 +643,7 @@ function updateUIText() { modalTitle.textContent = i18n.t('congratulations'); } if (modalText) { - modalText.textContent = i18n.t('youReached20Points'); + modalText.textContent = i18n.t('youReached10Points'); } if (playAgainButton) { playAgainButton.textContent = i18n.t('playAgain'); diff --git a/index.html b/index.html index d064e34..7c9544c 100644 --- a/index.html +++ b/index.html @@ -62,7 +62,7 @@

Points:

-

0/20

+

0/10

@@ -83,4 +83,4 @@ - \ No newline at end of file + diff --git a/script.js b/script.js index 01e1941..fca08f0 100644 --- a/script.js +++ b/script.js @@ -66,8 +66,11 @@ window.addEventListener('load', async () => { */ function handleDifficultyChange() { gameState.difficulty = parseInt(difficultySlider.value); - difficultyDisplay.textContent = gameState.difficulty; - difficultyDescription.textContent = difficultyConfig[gameState.difficulty].description; + document.getElementById('difficulty-display').textContent = gameState.difficulty; + const config = difficultyConfig[gameState.difficulty]; + if (config && config.descriptionKey) { + difficultyDescription.textContent = i18n.t(config.descriptionKey); + } generateNewProblem(); } @@ -166,19 +169,8 @@ function displayProblem() { for (let i = 0; i < steps.length; i++) { const stepProduct = steps[i].product.toString(); - const totalWidth = stepProduct.length + steps[i].shift; - intermediateHTML += '
'; - - // Each row is offset one position to the left - // Add offset spaces at the beginning (left side) - for (let offset = 0; offset < i; offset++) { - intermediateHTML += ''; - } - - // Add empty spaces for shift - for (let s = 0; s < steps[i].shift; s++) { - intermediateHTML += ''; - } + const totalWidth = maxResultWidth; + intermediateHTML += '
'; // Add input fields for each digit for (let j = 0; j < stepProduct.length; j++) { @@ -186,9 +178,9 @@ function displayProblem() { } // Add trailing empty spaces on the right - const trailingSpaces = maxResultWidth - totalWidth - i; + const trailingSpaces = i; for (let e = 0; e < trailingSpaces; e++) { - intermediateHTML += ''; + intermediateHTML += ``; } intermediateHTML += '
'; @@ -448,8 +440,8 @@ function handleSubmitAnswer() { showFeedback('🎉 Correct! +1 point', 'correct'); updateScore(); - // Check if reached 20 points - if (gameState.points >= 20) { + // Check if reached 10 points + if (gameState.points >= 10) { showVictoryModal(); return; } @@ -502,7 +494,7 @@ function clearFeedback() { * Update score display */ function updateScore() { - pointsScoreDisplay.textContent = `${gameState.points}/20`; + pointsScoreDisplay.textContent = `${gameState.points}/10`; } /** @@ -643,7 +635,7 @@ function updateUIText() { modalTitle.textContent = i18n.t('congratulations'); } if (modalText) { - modalText.textContent = i18n.t('youReached20Points'); + modalText.textContent = i18n.t('youReached10Points'); } if (playAgainButton) { playAgainButton.textContent = i18n.t('playAgain'); diff --git a/translations/el.json b/translations/el.json index 3265578..4dc4de5 100644 --- a/translations/el.json +++ b/translations/el.json @@ -13,7 +13,7 @@ "points": "Πόντοι:", "newProblem": "Νέο Πρόβλημα", "congratulations": "🎉 Συγχαρητήρια! 🎉", - "youReached20Points": "Έφτασες τους 20 πόντους!", + "youReached10Points": "Έφτασες τους 10 πόντους!", "playAgain": "Παίξε Ξανά", "correct": "Σωστό! Εξαιρετική δουλειά! 🎉", "incorrect": "Λάθος. Προσπάθησε ξανά! 💪" diff --git a/translations/en.json b/translations/en.json index 03f062e..01b3156 100644 --- a/translations/en.json +++ b/translations/en.json @@ -13,7 +13,7 @@ "points": "Points:", "newProblem": "New Problem", "congratulations": "🎉 Congratulations! 🎉", - "youReached20Points": "You've reached 20 points!", + "youReached10Points": "You've reached 10 points!", "playAgain": "Play Again", "correct": "Correct! Great job! 🎉", "incorrect": "Incorrect. Try again! 💪" diff --git a/translations/es.json b/translations/es.json index 13d81c3..2b92e40 100644 --- a/translations/es.json +++ b/translations/es.json @@ -13,7 +13,7 @@ "points": "Puntos:", "newProblem": "Nuevo Problema", "congratulations": "🎉 ¡Felicitaciones! 🎉", - "youReached20Points": "¡Has alcanzado 20 puntos!", + "youReached10Points": "¡Has alcanzado 10 puntos!", "playAgain": "Jugar de Nuevo", "correct": "¡Correcto! ¡Excelente trabajo! 🎉", "incorrect": "Incorrecto. ¡Intenta de nuevo! 💪" diff --git a/translations/sv.json b/translations/sv.json index 42e89fd..f60f9a6 100644 --- a/translations/sv.json +++ b/translations/sv.json @@ -13,7 +13,7 @@ "points": "Poäng:", "newProblem": "Nytt Problem", "congratulations": "🎉 Grattis! 🎉", - "youReached20Points": "Du har nått 20 poäng!", + "youReached10Points": "Du har nått 10 poäng!", "playAgain": "Spela Igen", "correct": "Rätt! Bra jobbat! 🎉", "incorrect": "Fel. Försök igen! 💪"