Skip to content
GitHub1.1k

Question types

Razzia has three question types, set with the type field of each question. When type is omitted, the question is a single-answer one.

Type Players… Scored on
single pick exactly one answer being right, and how fast
multi pick one or more answers the right picks, and how fast
estimation give a number how close they get

The default type. Players pick one answer among 2 to 4, and solutions holds the index of the right one:

{
"question": "What is the capital of France?",
"answers": ["Berlin", "Paris", "Madrid", "Rome"],
"solutions": [1],
"cooldown": 5,
"time": 15
}

A right answer earns up to maxPoints (1000 by default). The faster the answer, the more points it earns. See Speed and points.

With "type": "multi", players can pick several answers, and solutions lists every right one:

{
"type": "multi",
"question": "Which of these are primary colors?",
"answers": ["Red", "Green", "Blue", "Yellow"],
"solutions": [0, 2, 3],
"options": { "scoringMode": "balanced" },
"cooldown": 5,
"time": 20
}

options.scoringMode decides how a partly right selection is scored:

Mode How it scores
strict Full points only if the selection matches the solutions exactly, nothing otherwise.
balanced Each right pick earns its share of the points, and each wrong pick cancels one right pick. This is the default.
lenient Each right pick earns its share of the points, and wrong picks cost nothing.

For example, with three right answers out of four and a player who picks two right answers and one wrong one:

  • strict gives no points, because the selection isn’t exact.
  • balanced gives a third of the points: two right picks minus one wrong pick, out of three.
  • lenient gives two thirds of the points: two right picks out of three.

An estimation question asks for a number instead of offering answers, like “How many days does a fly live?”. Players answer with a slider or by typing a number, and they are scored on how close they get, not on how fast they answer.

In the editor, set the answer mode to Estimation, then set the bounds and the expected answer on the slider, and the input type, step and margin in the settings.

The editor on an estimation question: a slider from 0 to 60 with the correct answer set to 28, and the input type, step and margin settings

In JSON:

{
"type": "estimation",
"question": "How many days does a fly live?",
"answers": [],
"solutions": [28],
"options": {
"inputMode": "slider",
"min": 0,
"max": 60,
"step": 1,
"margin": 5
},
"cooldown": 5,
"time": 30
}
  • answers is always an empty array.
  • solutions holds a single value: the expected number, between min and max.
  • options.inputMode is slider to pick a value on a slider, or input to type it.
  • options.min and options.max bound the accepted values. max must be greater than min.
  • options.step is the precision of the slider, and must be greater than 0.
  • options.margin is how far from the expected value an answer still counts as right.

The scoring follows the margin:

  • An exact answer earns maxPoints.
  • An answer at the edge of the margin earns half of it, and the points decrease steadily in between.
  • An answer outside the margin earns nothing, and costs the penalty if one is set.

With a margin of 0, only the exact value counts.

For single and multiple answer questions, speed matters. A player who answers right away can earn up to maxPoints, and the points drop steadily as the timer runs, down to 0 at the end of the answer time.

With "time": -1, the question has no time limit, and the points depend on the order of the answers instead: the first player to answer can earn maxPoints, the last one half of it.

Estimation questions ignore speed: only the distance to the expected value counts.

Two fields tune the scoring of any question:

  • maxPoints: the most points a right answer can earn. Defaults to 1000. Set it to 0 for a question that doesn’t count.
  • penalty: the points a wrong answer costs. No penalty by default. A player’s total never goes below 0, and a player who doesn’t answer loses nothing.
{
"question": "Bonus: what year did the Berlin Wall fall?",
"answers": ["1987", "1989", "1991", "1993"],
"solutions": [1],
"maxPoints": 2000,
"penalty": 500,
"cooldown": 5,
"time": 20
}