Workshop › 15 Puzzle › Step 16 of 27
A move counter at the top left shows how many slides you needed. It starts at 0 and goes up on every real slide.
```js
let moves
function reset() {
tiles = solvedTiles()
moves = 0
}
tiles[i] = 0
moves += 1
ctx.fillStyle = 'white'
ctx.font = 'bold 18px sans-serif'
ctx.textBaseline = 'alphabetic'
ctx.textAlign = 'left'
ctx.fillText('Moves ' + moves, LEFT, 36)
```moves starts at 0 in reset.moves += 1 is the last line of move: a tile far from the gap has already returned, so it is not counted.textBaseline = 'alphabetic' puts the text back on a normal line (the tiles set it to 'middle').let tiles ... write let moves.reset, write moves = 0; at the end of move, write moves += 1.draw, under the forEach block, leave an empty line and write the five text lines. Press Run.Skills: Game states
← Arrow keys Shuffle with real slides →