Skip to content

Interactive, timed quiz for listing the countries of the world.

Notifications You must be signed in to change notification settings

elektronstudio/countries-of-the-world-quiz

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Countries of the World Quiz

Live version.

Based off of the Sporcle Countries of the World Map Quiz.

The trickiest part of this quiz game is identifying when an user enters a "correct" country name. While "Most Serene Republic of San Marino" is the official name of a country, "San Marino" should also be accepted as a "correct" name for this peaceful city state, for the sake of fun. I accomplish this by accepting the "common" or "official" names of each country in the https://github.com/mledoze/countries/ dataset and providing a way to easily add country aliases (send a pull request!). The following section describes how the matching process works in more detail.

Mechanism for identifying "correct" country names

The countries variable from countries.js file is a list that contains an entry for each country in the quiz, e.g. [39.622000,-98.606000,"United States","United States of America","USA"] is the entry for the USA. Each entry is in the format [Latitude, Longitude, Name 1, Name 2, ..., Name n]. The quiz will accept any of Name 1 through Name n (or their lowercase versions) as "correct" for the a given country, thus, to add an alias for a country, simply append the alias at the end of its entry. For example, I have manually added USA as an alias for United States of America in line 232 of countries.js.

To generate countries.js from scratch you must download the following files and unzip/move them to data/ (i.e. data/countries.json and data/TM_WORLD_BORDERS_SIMPL-0.3.shp should exist), then run countries_to_json.py (warning this will overwrite the existing countries.js file):

The countries_to_json.py script performs the following:

  • Loads the latitude and longitude coordinates from each country in TM_WORLD_BORDERS_SIMPL-0.3.shp by their ISO3 codes.
  • Matches the previously loaded ISO3 codes to the countries.json file from the https://github.com/mledoze/countries/ dataset, then extracts the country's "common" and "official" names.
  • Writes each matched country to countries.js.

About

Interactive, timed quiz for listing the countries of the world.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 36.7%
  • CSS 32.9%
  • HTML 27.4%
  • Python 3.0%