Review Algorithmic Thinking by Building a Dice Game - Step 12 Possible Issue

Tell us what’s happening:

I read I should post here before creating a github issue. I also couldn’t find this issue on github. Lets go!
It says “You should call your resetGame function after displaying the alert in your keepScoreBtn listener.”
It also provides a blank line in keepScoreBtn under

}, 500);

implying you should put resetGame() in that location. However I now know it wants it above

}, 500);

It’s misleading. If you want us to figure out location ourselves, then not having the blank line seems more sufficient. I felt I should report it in case it is a bug. When searching for help on the forum on this step, I noticed hbar1st mention to someone “put the resetGame call in the empty line inside this block so it gets called after the round is > 6” Which is incorrect that is why I am assuming it is a bug.
PS I had the rest of this steps code correct, I removed it as to not spoil the step for others.

Your code so far

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

/* file: styles.css */

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

const resetGame = () => {
  
};

rollDiceBtn.addEventListener("click", () => {
  if (rolls === 3) {
    alert("You have made three rolls this round. Please select a score.");
  } else {
    rolls++;
    resetRadioOptions();
    rollDice();
    updateStats();
    getHighestDuplicates(diceValuesArr);
  }
});

rulesBtn.addEventListener("click", () => {
  isModalShowing = !isModalShowing;

  if (isModalShowing) {
    rulesBtn.textContent = "Hide rules";
    rulesContainer.style.display = "block";
  } else {
    rulesBtn.textContent = "Show rules";
    rulesContainer.style.display = "none";
  }
});

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}`);
      }, 500);
      resetGame();
    }
  } else {
    alert("Please select an option or roll the dice");
  }
});

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:132.0) Gecko/20100101 Firefox/132.0

Challenge Information:

Review Algorithmic Thinking by Building a Dice Game - Step 12

I agree that the blank line is misleading. Worth opening an issue on GitHub about this since many people hit it.

Awesome, I will do that now. I am excited to start contributing going towards my new career goal.

1 Like