public void SetCapital(IHexMap map) { // First try to set any harbor city var allCities = Provinces.Select(p => p.Capital).ToList(); var harborCities = allCities.Where(t => map.GetNeighbours(t).Where(n => n.TileTerrainType == TileTerrainType.Water).Any()).ToList(); var cities = harborCities.Any() ? harborCities : allCities; var rand = new System.Random(); var index = rand.Next(cities.Count); Capital = cities[index]; Capital.Province.IsCapital = true; }
public string ListMembers() => string.Join(" ", Provinces.Select(p => p.Id.ToString()));
private int GetMaxIdProvince() => Provinces.Select(province => province.Id).Prepend(0).Max();