Dev.to WebDev 🛠 Dev 👁 0 📖 2 min read

The Draw and Guess score in code: a floor, a range and a decaying share

Draw and Guess scores a guess from the time left and the order of the guess. The rule is short, and it makes a good small example of designing a score you can explain. This is how it reads as code. The speed po

Draw and Guess scores a guess from the time left and the order of the guess. The rule is short, and it makes a good small example of designing a score you can explain. This is how it reads as code.

The speed points

The constants are a floor of 100 and a range of 400. The speed points for a guess are the floor plus the range times the fraction of time left, rounded to a multiple of five:

speed = round5(100 + 400 * left / total)

At the default 100 seconds an instant guess scores 500 and a last-second one 100. Each second is worth four points. On a 40-second drawing every second is worth ten points.

The order share

The first right guess is paid every speed point. The second keeps about 56%, the third about 38%, the fourth about 29%, the fifth about 24%, and no later guess falls below 20%. A formula that fits those numbers is:

share(k) = max(0.2, 1 / (1 + 0.8 * (k - 1)))

I fitted that to the published shares. It is a description, not the source.

The drawer

The drawer gets the mean of everyone else's speed points, with a non-guesser counted as zero. Three guessers on 400, 325 and 250 give the drawer 325. If nobody guesses, the drawer scores nothing. In a room of two, the drawer gets what the one guess earned.

Why this design

  1. Speed matters, but not too much. The floor of 100 means a late right guess still scores.
  2. Order matters, with a floor. The share never falls below 20%, so the last right guesser is not ignored.
  3. The drawer is tied to the group. A clear drawing pays everyone.

A test

Check your own score by hand for a three-player round. If your numbers do not match the screen, one of us has a bug.

Where to see it

You can watch the formula work on Boardit's Draw and Guess.

When the hints land

The score and the hints share a clock. On a 100-second drawing with three hints, the hints fall at 75, 50 and 25 seconds left, which are also the moments when a guess is worth 400, 300 and 200 points, so each hint arrives a quarter of the range lower.

The score in a line

Floor plus range times time left, then a share by order.

Ahmed Moaz builds Boardit, a free browser game site.

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.