# Learn Intermediate Algorithmic Thinking by Building a Dice Game - Step 87

The Dice game itself doesn’t work.

I answered the questions, and completed the code, but if I roll, say “1, 2, 3, 4, 6” it doesn’t give me the “Small Straight” option. Probably just an oversight, and easy to update with a “forEach” loop rather than just an “includes”

``````const checkForStraights = (arr) => {
const sortedNumbersArr = arr.sort((a, b) => a - b);
const uniqueNumbersArr = [...new Set(sortedNumbersArr)];

const smallStraightsArr = ["1234", "2345", "3456"];
const largeStraightsArr = ["12345", "23456"];

//***issue is here***
}

}

};
``````

Learn Intermediate Algorithmic Thinking by Building a Dice Game - Step 87

I can’t reproduce your issue. `includes` should work correctly - `includes` does the same thing as a `for` loop checking to see if the array includes the value.

Some straights can be missed, you are right.

This is caused by the `smallStraightsArr` contain only cases with `4` numbers:

``````  const sortedNumbersArr = arr.sort((a, b) => a - b);
const uniqueNumbersArr = [...new Set(sortedNumbersArr)];

const smallStraightsArr = ["1234", "2345", "3456"];
``````

This will work when rolled die have one repeat, ie. `1, 2, 2, 3, 4` - `Set` handles the duplicated `2`.
On the other hand when all die have unique numbers, ie. `1, 2, 3, 4, 6`, the `uniqueNumbersStr` will be `"12346"` and it will not be detected.

1 Like

To reproduce just manually change the “rollDice” function from an empty array to [1,2,3,4,6].

What it’s trying to do is see if smallStraightArr - [“1234”, “2345”, “3456”] INCLUDES “12346”, which it doesn’t

Ah, I see the issue now. But no, its not something that’s fixed by ‘just’ using a `forEach` loop.

Why not?

``````smallStraightArr.forEach(straight => {
if(uniqueNumberStr.includes(straight)) {
}
}
``````

Ah, that’s what you meant by "easy to update with a `forEach`. I’d use this:

``````  if (largeStraightsArr.includes(uniqueNumbersStr)) {
}