In 2021, I started a tradition of building a project around Christmas time. In 2021, I created a trivia quiz, and in 2022, I created a music quiz. This year, I created a trivia quiz again.
I previously wrote about how I created the 2022 quiz here. This year’s is effectively a branch of that project, with a few changes.
The main change is that I’ve added time-sensitive questions. The longer the player takes to answer the question, the fewer their points. I implemented this as it seemed that people were cheating in the public deployment (I created a separate deployment for family and friends).
The core of this feature is in the following code block. It is straightforward and contains little logic. Next year, I may refine it further and involve some scoring curve.