Skip to content

Zverik/sotm2020-quiz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

State of the Map 2020 Trivia Quiz

This is a simple static single-player trivia quiz game, made for a nice look and easy question replacement. Thanks to Vue.js authors which made making this game very quick, and to State of the Map 2020 organizers that made me do a quiz and then asked for it to be re-playable.

Play the Quiz!

How to steal the code

You can reuse the code and the template to do your own quiz! The license permits anything, so go ahead. This is what you need to do:

  1. Clone the repo, or better download index.html and quiz.js.
  2. If needed, translate text in index.html into your language.
  3. Change the title in index.html to yours.
  4. Prepare the questions file (see below) and replace sotm2020.js in index.html with its name.
  5. To add images, create images directory and put all jpeg and pngs there.
  6. Upload all these files into a new github repo (or commit your changes to a fork).
  7. Go to repo settings, enable github pages on the master branch, share the URL with your players.

Questions file format

A questions file is a JavaScript file that has a single JSON object inside, in form quiz = {...}. This object has two mandatory fields: "title" and "questions". Here is what fields mean:

  • title: title for the quiz, will be displayed as headers on the first and last card.
  • picture: title image for the quiz.
  • intro: introductionary text for the quiz. Few markdown features supported: paragraphs, links, images, bold and italic text, inline code.
  • afterword: markdown text to be printed after the quiz is complete.
  • ranks: list of titles for a person who completed the quiz, depending on number of correct answers. Ordered from least to greatest. E.g. ["beginner", "student", "professor"].
  • questions: list of questions, see below.

Each question is an object with three mandatory fields (text, answers, correct) and some optional fields:

  • text: question, markdown supported.
  • picture: optional image for the question.
  • answers: list of answer, each a short string.
  • correct: list of 1-based indices of correct answers. E.g. [1] means the first answer only is correct.
  • stats: list of number of people who chose the relevant answer. E.g. [3, 1, 8] means that 3 players chose the first answer, 1 player chose the second one.
  • explanation: markdown-supported explanation for the answers that appears after a player chooses an answer.

See the sotm2020.js file for an example.

Importing quiz from MyQuiz

This script was primarily written to make a stand-alone single-player version of a MyQuiz quiz. To import yours, do this:

  1. Open the "Archive" tab and find your quiz. If it isn't there, make you you've played through it at least once.
  2. Click on the "Settings" button near the proper game and choose "Quiz Report → Export to csv".
  3. Run the script tools/myquiz_to_json.py QuizReport.csv questions.js (adjust the file names as needed).
  4. If you don't need answer statistics, edit the resulting js file and replace "stats" to e.g. "stat".
  5. Make sure the js file name in index.html is correct.

Author and License

All of this was published by Ilya Zverev under MIT License.

About

Static single-player trivia quiz game about OpenStreetMap. You can use the code for hosting a myquiz archive, or for your own game.

Topics

Resources

License

Stars

Watchers

Forks

Contributors