Workshop › Simon Says Colors › Step 13 of 27
The game has two phases: the computer is 'showing' the sequence, or it waits for the player's 'input'. After a
short pause (timer), the computer lights the first pad for 30 frames and hands the turn to the player.
```js
let state // 'showing' or 'input'
let timer
state = 'showing'
timer = 40 // a short pause before the sequence is shown
if (state !== 'showing') return
timer -= 1
if (timer > 0) return
light(sequence[0], 30)
state = 'input'
```nextRound starts the show: state 'showing', a 40 frame pause.update: if we are not showing, stop here. Otherwise count timer down; while time is left, stop here.let sequence, write let state and let timer.nextRound, under push, set state and timer.update, under the litFor block, write the five new lines.Skills: Game states, The game loop
← Go dark again Show the whole sequence →