Workshop › Klondike Solitaire › Step 33 of 40
A clock makes the game a race. The loop runs 60 times a second, so counting its frames and dividing by 60 gives the seconds.
```js
let frames
frames = 0
ctx.fillText('Moves ' + moves + ' Time ' + Math.floor(frames / 60), LEFT, 24)
function loop() {
frames += 1
```frames counts the loop's turns and starts at 0 with every deal.Math.floor(frames / 60) is the whole seconds: 150 frames is 2.5, shown as 2.let moves write let frames; in deal, under moves = 0, write frames = 0.draw, extend the Moves text with the time.loop, write frames += 1 as the first line.Skills: The game loop, Game states
← Drop a king into an empty column Winning →