Ejemplo n.º 1
0
        void CreateRegions(Random Random, int Number, Language Language)
        {
            MicroRegion[] Arr = new MicroRegion[_Settings.Height * _Settings.Width];
            for (int i = 0; i < _Settings.Width; ++i)
            {
                for (int j = 0; j < _Settings.Height; ++j)
                {
                    Arr[i * _Settings.Height + j] = _MicroRegions[i, j];
                }
            }

            for (int i = 0; i < Arr.Length; ++i)
            {
                MicroRegion T     = Arr[i];
                int         index = Random.Next(0, Arr.Length);
                Arr[i]     = Arr[index];
                Arr[index] = T;
            }

            DijkstraPool <MicroRegion> pool = new DijkstraPool <MicroRegion>();
            CultureMap cultureMap           = new CultureMap(Random, _Settings.Culture);

            _Regions = new Region[Number];
            int c = 0;

            for (int i = 0; i < Arr.Length && c < Number; ++i)
            {
                if (!Arr[i].Oceanic && Random.NextDouble() < Math.Sqrt(Arr[i].Biome.RegionSlow))
                {
                    string Name = Language.Generate(Random).Orthography;
                    Region R    = new Region(
                        char.ToUpper(Name[0]) + Name.Substring(1),
                        Arr[i],
                        cultureMap.Generate(Arr[i].X, Arr[i].Y),
                        _Settings.Economy);
                    pool.Drop(R);
                    _Regions[c] = R;
                    ++c;
                    R.Culture.Colors                = _Settings.FlagColorMap.Closest(R.Culture, 3);
                    R.Administration.Flag           = Settings.FlagData.CreateFlag(R.Culture, Settings.FlagColorMap, Random);
                    R.Administration.GovernmentForm = GovernmentForm.AllValidGovernmentForms(
                        g => !g.Integrated && g.Devolved && g.Tributary).ArgMax(R.Culture.Favorability);
                }
            }
            pool.Resolve();
            foreach (Region R in _Regions)
            {
                R.DiscoverBorder();
            }
        }
Ejemplo n.º 2
0
 public Country(int id, string name, string countryCode, string continent, int population, int area, GovernmentForm governmentForm, string currency, string currencyCode, double birthrate, double deathrate, double lifeExpectancy)
 {
     Id             = id;
     Name           = name;
     CountryCode    = countryCode;
     Continent      = continent;
     Population     = population;
     Area           = area;
     GovernmentForm = governmentForm;
     Currency       = currency;
     CurrencyCode   = currencyCode;
     Birthrate      = birthrate;
     Deathrate      = deathrate;
     LifeExpectancy = lifeExpectancy;
 }
Ejemplo n.º 3
0
 public override string ToString()
 {
     return(Code.PadRight(5) + Name.PadRight(20) + Continent.PadRight(30) + SurfaceArea.ToString("N2").PadRight(10) + Population.ToString("N0").PadRight(15) + GovernmentForm.PadRight(30));
 }
Ejemplo n.º 4
0
        public double Favorability(GovernmentForm Government)
        {
            double Total = 0;

            if (Government.Devolved)
            {
                Total += 1 - _PowerDistance;
            }
            else
            {
                Total += _PowerDistance;
            }

            if (Government.Integrated)
            {
                Total += _UncertaintyAvoidance;
            }
            else
            {
                Total += (1 - _UncertaintyAvoidance);
            }

            if (Government.RegionControl)
            {
                Total += (1 - _Individualism);
            }
            else
            {
                Total += _Individualism;
            }

            if (Government.SubRegionControl)
            {
                Total += Math.Sqrt(1 - _Individualism);
            }
            else
            {
                Total += Math.Sqrt(_Individualism);
            }

            if (!Government.Tributary)
            {
                Total += 1;
            }

            if (Government.UnanimousConsent)
            {
                Total += 1 - _PowerDistance;
            }
            else
            {
                Total += _PowerDistance;
            }

            if (Government.Voluntary)
            {
                Total += 1 - _Toughness;
            }
            else
            {
                Total += _Toughness;
            }

            return(Total);
        }