Review Algorithmic Thinking by Building a Dice Game - Step 12

Tell us what’s happening:

MY code is correct but the system doesnt accept it

Your code so far

<!-- file: index.html -->

/* file: script.js */
// User Editable Region

const resetGame = () => {
  listOfAllDice.forEach(element => element.textContent = 0);

  score = 0;
  rolls = 0;
  round = 1;

  totalScoreElement.textContent = score;
  rollsElement.textContent = rolls;
  roundElement.textContent = round;
  

  resetRadioOptions();
  
};
///untouch
keepScoreBtn.addEventListener("click", () => {
  let selectedValue;
  let achieved;

  for (const radioButton of scoreInputs) {
    if (radioButton.checked) {
      selectedValue = radioButton.value;
      achieved = radioButton.id;
      break;
    }
  }

  if (selectedValue) {
    rolls = 0;
    round++;
    updateStats();
    resetRadioOptions();
    updateScore(selectedValue, achieved);
    if (round > 6) {
      setTimeout(() => {
        alert(`Game Over! Your total score is ${score}`);
        resetGame();
      }, 500);
      
    }
  } else {
    alert("Please select an option or roll the dice");
  }
});

// User Editable Region
/* file: styles.css */

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 12

Welcome to the forum @ece21100

Copy the reset function, reset the step, then paste the reset function back into the editor.

Then scroll or arrow down to the keepScoreBtn event listener and add the function call.

Happy coding

2 Likes

Thank you!! I was struggling with the same, shift + f15 :slight_smile:

1 Like