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 europe

oceania oceania

north america 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

  • sbird@lemmy.worldOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    15 hours ago

    does this issue not apply to other programming languages? dependency hell exists outside of python too yk…

    allso, I’m not using too many modules for this, most of it is “vanilla” python, if you will. I’ve only got a module that makes it easier to create coloured text and another one to generate ascii art. maybe the latter uses a few extra modules, but this project is relatively small and simple and it’s just a funny little game. I actually used to not use the ascii art generator module before and just used to text to ASCII art generators, but it was getting really annoying having to backslash all the backslashes

    • The Bard in Green@lemmy.starlightkel.xyz
      link
      fedilink
      English
      arrow-up
      1
      arrow-down
      2
      ·
      edit-2
      9 hours ago

      does this issue not apply to other programming languages? dependency hell exists outside of python too yk…

      This is like I have a swimming pool and a snapping turtle from the local estuary sometimes ends up camped out in it. But YOU have a swimming pool and it’s full of alligators. When I complain that I don’t wanna go in your swimming pool, you’re like “Doesn’t yours ALSO sometimes have dangerous reptiles?” And I’m like…dude…

      I’m been a developer for a long time. I know what a normal amount of pain is. This stack causes an ABNORMAL amount of pain, like badly designed exercise equipment a bunch of sycophantic fitness bros keep pumping on social media, even though it regularly causes back injuries.

      I think Python devs only think it’s normal because you’re used to it or something.

      allso, I’m not using too many modules

      Great, but you picked a stack in the middle of a toxic garbage dump. Maybe it’s the clean part of the garbage dump. IDK. I just wish people would stop, because there are so many awesome stacks out there, so I don’t have MORE reasons to have to wade back in here.

      And THAT is the origin of the Facebook analogy (the only reason I have to keep using this is because EVERYBODY ELSE IS).

      I’m LITERALLY going through Python dependency hell again right this very second, trying to deploy some shit we need for next week and I’m just like I swear to god, this motherfucking broken ass ecosystem

      🚀💥