The number correspond to *.nam file alphabetical order, i.e.:
American = US flag = 0
Arabic = Egypt flag = 1
Belgium = 2
British = 3
Bulgarian = 4
...
...
Turkish = 32
If you have different *.nam files, your ordering will be different.
Isn't this rather setting up for unnecessary maintenance in he future? There's a long-established system for encoding country/ nationality names. It may be convenient to create something new for a first-run test, but unless you want to be dealing with 184 (or is it 196, I forget) entries in the code table, as well as needing maintenance when new countries/ nationalities are created / merged ... well, it's your code.
ISO-3166 - which uses well-known 2-letter codes (EN, AU, CA, US, for example ; if you think "they look like internet top-level domains", you're pressing the right button. Slightly less well known are the equivalent
3-digit codes (826, 036, 124, 840 for the same countries ; if you think they look like DOS code page numbers, you're right).
To quote two lines from the Wiki page,
An advantage of numeric codes over alphabetic codes is script (writing system) independence. (...)
Another advantage is that when countries merge or split, they will get a new numeric code
The needs of users who need to add their own distinctions (trivially, the Pirate nation ; less laughably you might wish to distinguish between USians and members of the Navajo Nation. For this, there are codes 900 to 999.
How to interpret a NULL or NaN code - e.g. your "unassigned" status issue ... might be covered in the detailed ISO (they tend to have thought these things through). Or you could assign a
whole-Earth nationality and flag. (I'll note that the space view is from approximately above the "Cradle of Humanity" in East Africa", where humans originated.)
Anyway, your code. Sounds a fun idea.