Tell us what’s happening:
Tests 2,3,4 aren’t passing but my own tests work fine. E.g (6,5,4,3,2) and (1,2,3,4,6) update the radio buttons to be: large,small, none OR small, none respectively. Am i doign something wrong?
Your code so far
<!-- file: index.html -->
/* file: script.js */
// User Editable Region
const checkForStraights = (arr) => {
let straightCount = 0;
let reverseCount = 0;
for(let i = 0; i < arr.length -1;i++){
const currentNum = parseInt(arr[i]);
//probably shouldve just sorted this but oh well
if(currentNum + 1 == arr[i+1]){
reverseCount = 0;
straightCount++;
}else if(currentNum -1 == arr[i+1]){
straightCount = 0
reverseCount++;
}else{
straightCount = 0;
reverseCount = 0;
}
if(straightCount == 3 || reverseCount == 3){
updateRadioOption(3,30);
}else if(straightCount ==4 || reverseCount == 4){
updateRadioOption(4,40);
}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();
const straightArrTest = [3,4,5,6,6]
getHighestDuplicates(diceValuesArr);
checkForStraights(diceValuesArr);
detectFullHouse(diceValuesArr);
console.clear()
}
});
// 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/129.0.0.0 Safari/537.36 Edg/129.0.0.0
Challenge Information:
Review Algorithmic Thinking by Building a Dice Game - Step 14