Workshop › Simon Says Colors › Step 24 of 27
Half a second per pad is fine at first, but boring by round ten. showFrames() makes the show faster as the sequence
grows, but never faster than 12 frames per pad.
```js
// Longer sequences are shown faster, down to a limit.
function showFrames() {
return Math.max(12, 30 - sequence.length * 2)
}
light(sequence[showAt], showFrames())
showAt += 1
timer = showFrames() + 8
```30 - sequence.length * 2 gets smaller every round: 28 frames in round 1, 20 in round 5.Math.max(12, ...) picks the bigger number, so it never goes under 12: a floor.showFrames() returns a number, so it can stand where 30 stood.nextRound, leave an empty line and write the comment and showFrames.update, replace the two 30s with showFrames().Skills: Game states, Functions
← Light up when pressed Save the best score →