For a developer, the interesting question about a quiz is how the scoring is built. Here is how Trivia Tavern turns a right answer into points. It is short enough to read in a minute.
The inputs
Each question has a difficulty, and difficulty sets its base points: easy is 100, medium 200, hard 300. The host chooses one of two modes for who gets paid how much. A question also has a time limit, 20 seconds by default.
Mode one: the race
This is the default. Right answers are paid by finishing order. In pseudo-code:
share = [1, 0.75, 0.6][rank - 1] ?? 0.5
points = max(10, round(base * share / 10) * 10)
The first right answer gets the full base. The second gets 75%, the third 60%, and everyone after that 50%. The result is rounded to the nearest ten, with a floor of ten.
Mode two: everyone scores
The host can switch to this mode. A right answer earns its base points, less a penalty for time:
share = 1 - 0.25 * clamp(timeTaken / timeLimit, 0, 1)
So an instant answer earns the full base, and an answer at the buzzer earns three quarters. The same rounding applies.
Why two modes
The source keeps a short history of the rule. An earlier version paid the first right answer everything, and testing showed it favoured quick connections over knowledge. The current modes spread the points over more players.
The closest-number question
Every round ends with a number question, and its score is a step function of the distance: 1.0 for exact, then 0.6, 0.4 and 0.2 at one, two and four times a per-question tolerance, plus a bonus of half again for the nearest guess.
The last round
A flag doubles the last round. A second flag, off by default, adds a wager question with four stake choices.
A note on design
Two things stand out when you read the scoring as code. It is small, with a handful of constants, and every number in it can be explained to a player in one sentence. That is worth aiming for in any game: if you cannot say why a score is what it is, the player will not trust it. The results are also rounded to the nearest ten so a scoreboard reads cleanly.
Try it
Boardit's Trivia Tavern is a free quiz for two to eight players. The code snippets above are my paraphrase of the scoring, and not the source.
Ahmed Moaz builds Boardit, a free browser game site.
Top comments (0)