Workshop › Whack-a-Mole › Step 14 of 18

How far into the round?

What we are doing

To make the game harder as it goes, we first need a number for how far the round is: 0 at the start, 1 at the end.

```js
// 0 when the round starts, 1 when it ends.
function progress() {
  return Math.min(1, Math.max(0, 1 - (endsAt - now) / ROUND))
}
```

What it means

Your turn

Under isUp, write the comment and progress.

Skills: Functions

All steps

  1. A green field
  2. Nine holes
  3. Draw the holes
  4. A clock and a loop
  5. A mole in a hole
  6. Moles pop up
  7. Which hole was clicked?
  8. Whack!
  9. Show the score
  10. Click to start
  11. Time's running
  12. Time's up
  13. Best score
  14. How far into the round?
  15. Faster and faster
  16. Remember each hit
  17. Floating +1
  18. Build it yourself: combos