note: i did NOT create the ASCII art. I’m not good enough to do that. I found on various ascii art archives as well as those image to ascii art converters for the continents I couldn’t find.
countryguess was a project I made recently because I wanted to make a quiz that could be customised as you see fit. Also, I had no clue how to make GUIs with Python and ASCII art is cool so I decided to roll with it. It turned out pretty cool!
I made the maps by printing the ASCII art map, and then all the spaces that make up each country would be an array. These arrays would fill up the spaces like morocco[0], morocco[1], etc.
Then, when the country is guessed, the country (or an alternate name/abbrviation, such as uk for the united kingdom or ivory coast for cote d’ivoire) is matched with its index in the list of countries in that continent.
A second list contains all the countries that show up on the map (excluding citystates, islands, etc. that aren’t big enough to be shown on the map) and has all the countries as either 0 (false) or 1 (true). Whenever the country is guessed, its respective list item turns into 1.
The map printing function checks each list item for whether it is true or false. If it is true, then the list of spaces for that country would be replaced with a list of equal length and equal number of characters but with hashes “#” instead of spaces " ". This means that, when the county is printed, hashes are printed instead of spaces and the country fills up
I’ve got africa, europe, north america, and oceania completed. I haven’t yet made the map for asia because it’s HUGE, and south america I haven’t done yet as well. Also, central/eastern europe is VERY out of proportion and will be fixed…eventually. (i.e. long romanian panhandle)
other fun features I added include the ability to enable/disable disputed territories (Western Sahara, Kosovo, and Somaliland bc why not) and the U.N. observer states (the Vatican and Kosovo) as well as score saving to a “scores.txt” that shows the date, time, and name of quiz that you complete along with your score.
once I finished all the continents, I’ll work on making a world quiz with ALL the countries. other things like capital quizzes and flag quizzes could be added on later, but that’s likely very far into the future.
here are some more screenshots:
europe
oceania
north america
the github link if you want to look at the code or just have a go at the quiz: https://github.com/swarbler/countryguess
Ah Python, the Facebook of programming languages.
note: i did NOT create the ASCII art. I’m not good enough to do that. I found on various ascii art archives as well as those image to ascii art converters for the continents I couldn’t find.
FYI:
$ telnet mapscii.me
Zoom is “a” and “z”, arrow keys pan, “q” quits.
e.g.:
Can produce a map of wherever at whatever zoom.
This is so cool!
oh damn that’s kinda cool
Traceback (most recent call last): File "<redacted>\countryguess\countryguess.py", line 3, in <module> from art import * ModuleNotFoundError: No module named 'art'
you might want to add a requirements.txt
oop yep that’s probably important. I’ve added that to the repo!
wow that’s… quite a list. Are you sure you need them all? What are you using like redis, yt-dlp or spotifyapi, ytmusicapi for??
oh wait shoot did it just add all the modules installed on my computer…damn… how do I make a proper requirements.txt? that pip command definitely didn’t do it…
Are you using a virtual env to isolate the environment of the game from the rest ofyour system? There are a few ways/tools to do it but maybe start here:
ok haha, I guessed something like that must’ve happened
ok I fixed it, it should just be “art” (a library to make ascii art) and “colorama” (easier coloured text)
Cool project!
besides weird central/eastern europe chaos, there’s also no islands that are highlighted at all in north america, not even the big ones like cuba or haiti/dominican republic. I will probably add those at some point, but that’ll be later.
another upside to this quiz over things like Sporcle is that since it’s a python program, you don’t need an internet connection to play it.