# Thread: Help with possible triple-nested structure.

1. ## Help with possible triple-nested structure.

Hello all, I'm trying to make a political card game using continents, countries, and states as areas that two sides vie to control.

I think I need to use structures. One for the continents, one for the countries, and one for the states.

My current problem is how to set this up in code. Do I say that the continent structure contains the country structure and the state structure? Or, do I say the continent structure contains the country structure which contains the state structure?

Or, is it the opposite, where the the continent structure is contained in the country structure. And the country structure is contained in the state structure?

Some pseudo code to demonstrate what I'm thinking about:

Code:
```struct Continent
{
int stuff;
};

struct Country
{
struct Continent info;
int more_stuff;
};

struct State
{
struct Country more_info;
int other_stuff;
};

or

struct Continent
{
int stuff;
};

struct Country
{
struct Continent info;
int more_stuff;
};

struct State
{
struct Continent info;
struct Country more_info;
int other_stuff;
};```

2. Can a country be on more than one continent?

Can a state have more than one country?
Country and state are pretty synonymous, unless you're counting odd-balls like the Vatican (a state) within a country (Italy).

3. I would choose the second one. However, do all countries have "States"? How are other countries subdivided, or not?
How would you handle the difference in Politics in the various countries?

4. My apologies, I had a difficult time wording my question. In this case 'state' would also mean province or territory, or some other sub-division of a county.

I am concerned about my second option, in that the struct Country contains the struct Continent and the struct State contains the structs Continent and State.
Wouldn't the struct State contain two of the struct Continent? One by itself and the one contained in struct Country?

If I need to do a better job of explaining what I'm trying to do, please let me know.

5. The whole this is very complex. Countries spanning Asia and Europe, Italy that contains separate "Countries", The Vatrican and San Marino. Countries that have no concept of divisions, and probably other complications I don't even know about. Then there is the whole discussion of the differences of "Politics" in various countries.

I would define the simple versions of the structs as:
Code:
```struct Continent
{
int stuff;
};

struct Country
{
struct Continent info;  //Multiples?
int more_stuff;
};

struct State
{
struct Country more_info;
int other_stuff;
};```
Or:

Code:
```struct Continent
{
int stuff;
};

struct State
{
int other_stuff;
};

struct Country
{
struct Continent info; // Multiples?
struct state[X];  //Array of "States" or "Divisions"
int more_stuff;
};```
Good luck!

6. Data models are hard!

How about using the more abstracted 'regions' structure?

Countrys could be owners of regions...