Tell us what’s happening:
It says “If a large straight is rolled, your checkForStraights function should also enable the fourth radio button, set the value to 30, and update the displayed text to , score = 30.” but it also says “If a large straight is rolled, your checkForStraights function should also enable the fifth radio button, set the value to 40, and update the displayed text to , score = 40.” when the code is changed from updateRadioOption(3, 30) to updateRadioOption(4, 40).
Your code so far
<!-- file: index.html -->
/* file: script.js */
// User Editable Region
const checkForStraights = (arr) => {
const sortedArr = Array.from(new Set(arr)).sort((a, b) => a - b);
const largeStraightSequences = [
[1, 2, 3, 4, 5],
[2, 3, 4, 5, 6]
];
const smallStraightSequences = [
[1, 2, 3, 4],
[2, 3, 4, 5],
[3, 4, 5, 6]
];
const isLargeStraight = largeStraightSequences.some(seq =>
seq.every(num => sortedArr.includes(num))
);
const isSmallStraight = smallStraightSequences.some(seq =>
seq.every(num => sortedArr.includes(num))
);
if (isLargeStraight) {
updateRadioOption(4, 40);
} else if (isSmallStraight) {
updateRadioOption(3, 30);
} else {
updateRadioOption(5, 0);
}
}
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);
detectFullHouse(diceValuesArr);
}
});
// 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/128.0.0.0 Safari/537.36 Edg/128.0.0.0
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 14