I've done it

I have recently made some “metric” considerations on a memory game that offered “all” national flags. The result is huge, but it's really hard to appreciate how huge it is.

My final comment in the previous post was that a possible choice to have a large number of flags was to rely on the Regional Indicator Symbols pairs supported since Unicode 6.0, that covers 258 regions and thus requires 516 cards.

Get the code for
Uniflags, a memory game with UNICODE flags:


So I've done it. I have created a playable (single player only, at the moment, sorry!) Memory game based off the “current” RIS pairs.

And it is huge. Humongous. To appreciate how impractically large it is, you'll probably have to zoom out to see all of the tiles. Now try playing. See how far you can go, how quickly you'll forget.

But before you do, a couple of implementation notes.


The initial card layout will be square-ish or rectangular-ish depending on the aspect ratio of your browser window. One the cards are laid out (on load), resizing the window will not change the layout (obviously).

There are only two layouts. The rectangular layout has a fixed aspect ratio, so there's not going to be a different layout for, say, 16:10 vs 2:1. However, the rectangular layout also has a vertical version.

One feature that would be nice to have is an option to let the user choose a layout.


Playing is very simple: click on a hidden card to show it, and when you have two cards showing, click on either card to hide both of them. If the two shown cards form a match, they will be ‘locked open’, and you can uncover a new pair. The ‘scoring tile’ keeps track of how many pairs you've uncovered (matched or not), how many turns you've taken (i.e. how many times you've uncovered pairs that were not matches), and how many matches you've found out of the 258 total.

If you click wrongly (e.g. try to uncover a new card when there are two out, or click on the currently uncovered card when there is a single one out), the score tile will give you an error message, and then you can keep playing.

The game page is ‘stateless’, which means it doesn't remember anything: not your best score (for example) nor (most importantly) the current distribution: if you (need to) reload the page for any reason, the game will be reset and you'll find yourself playing a new one.


Beware of duplicate flags! Some regions appear to have the same flag (at least on my system). Examples are the United States of America (RSI US or 🇺🇸) and their Minor Outlying Islands (RSI UM or 🇺🇲), or Norway (RSI NO or 🇳🇴) and Svalbard & Jan Mayen (RSI SJ or 🇸🇯). The tiles will be different because the name of the country is included in the tile, but you'll need to look out for it.


Currently the little text there is (mostly, the region names) is in English. It could be localized. Ideally, for the region names, I'd like to include both the ‘native’ name (for appropriate definition thereof), and a localized name, with the localization taken from the browser/user preferences.


Hot-seat multiplayer wouldn't be too hard to do. The only thing needed is a way to choose the number of players, and to include multiple scoring tables.


I'm releasing Uniflags under version 2.0 of the Mozilla Public License, even though I haven't found the correct way to include the information in the page itself (HTML metadata is unintuitive and boring).