Workshop › Minesweeper › Step 21 of 26
When the game is over, the top strip says so, in green or red, and a click starts a new game.
```js
canvas.addEventListener('click', (event) => {
if (state === 'won' || state === 'lost') {
newGame()
return
}
if (state === 'won' || state === 'lost') {
ctx.textAlign = 'center'
ctx.fillStyle = state === 'won' ? '#4ade80' : '#f87171'
ctx.fillText(state === 'won' ? 'You win!' : 'Boom! Click to retry', canvas.width / 2, TOP / 2)
}
```newGame() instead of doing nothing.? : picks its colour and text.if block with newGame().draw, under the 💣 line, leave an empty line and write the message block. Press Run.Skills: Game states, Keyboard and mouse input