/// <summary> /// Calculates the transfers. /// </summary> /// <param name="superRegion">The super region.</param> public void CalculateTransfers(SuperRegion superRegion) { bool skipSuperRegion = StrategyManager.SkipSuperRegion(superRegion); if (skipSuperRegion) { return; } bool transferDone = false; bool borderTerritoriesWithEnemyArmies = StrategyManager.EnemyBorderTerritories(superRegion, SuperRegions); bool regionsWithEnemyArmies = StrategyManager.EnemyRegions(superRegion); if (!borderTerritoriesWithEnemyArmies && !regionsWithEnemyArmies) { transferDone = CalculateForNoEnemies(superRegion); } if (borderTerritoriesWithEnemyArmies && !transferDone) { transferDone = CalculateForEnemyBorderTerritories(superRegion); } if (regionsWithEnemyArmies && !transferDone) { transferDone = CalculateForEnemyRegions(superRegion); } var stuckArmies = StrategyManager.GetStuckArmies(superRegion, Transfers); CalculateForStuckArmies(stuckArmies); }
public static void TestSuperRegion(SuperRegion superRegion) { CopyCurrent2Simulate(); // Target regions - (SuperRegion, but not me) IEnumerable <Region> regionsToCombat = superRegion.Regions .Where(R => R.SimulatePlayer.In(PlayerType.NotMe)); // Attacklines (Me -> NotMe) IEnumerable <Connection> connectionsFromMeToNotMe = Map.Current.Connections .Where(CN => CN.SourceRegion.SimulatePlayer.Is(PlayerType.Me) && CN.TargetRegion.SimulatePlayer.In(PlayerType.NotMe) && CN.TargetRegion.SuperRegion == superRegion); List <Connection> SolutionConnections = new List <Connection>(regionsToCombat.Count()); ReciproceConn(regionsToCombat, connectionsFromMeToNotMe, SolutionConnections); Console.WriteLine("SR: {0} #R: {1} #R+: {2} #CN: {3} Solutions: {4}", superRegion.Id, superRegion.Regions.Count(), regionsToCombat.Count(), connectionsFromMeToNotMe.Count(), Solutions.Count()); Solutions.Clear(); }
/// <summary>Inits the default map.</summary> public static Map InitSmall() { UnitTestMap map = new UnitTestMap(); //map.ApplySettings(new Settings()); SuperRegion northAmerica = new SuperRegion(1, 4, map); SuperRegion southAmerica = new SuperRegion(2, 2, map); Region region1 = new Region(1, northAmerica); Region region2 = new Region(2, northAmerica); Region region3 = new Region(3, northAmerica); Region region4 = new Region(4, northAmerica); Region region5 = new Region(5, northAmerica); Region region6 = new Region(6, northAmerica); Region region7 = new Region(7, northAmerica); Region region8 = new Region(8, northAmerica); Region region9 = new Region(9, northAmerica); Region region10 = new Region(10, southAmerica); Region region11 = new Region(11, southAmerica); region1.AddNeighbor(region2); region1.AddNeighbor(region4); region2.AddNeighbor(region4); region2.AddNeighbor(region3); region2.AddNeighbor(region5); region3.AddNeighbor(region5); region3.AddNeighbor(region6); region4.AddNeighbor(region5); region4.AddNeighbor(region7); region5.AddNeighbor(region6); region5.AddNeighbor(region7); region5.AddNeighbor(region8); region6.AddNeighbor(region8); region7.AddNeighbor(region8); region7.AddNeighbor(region9); region8.AddNeighbor(region9); region9.AddNeighbor(region10); region10.AddNeighbor(region11); map.Add(region1); map.Add(region2); map.Add(region3); map.Add(region4); map.Add(region5); map.Add(region6); map.Add(region7); map.Add(region8); map.Add(region9); map.Add(region10); map.Add(region11); map.Add(northAmerica); map.Add(southAmerica); map.SetPickableStartRegions(new int[] { 1, 2, 3, 4, 7, 8, 9, 11 }); map.Finish(); return(map); }
public static Region MixedRegion(SuperRegion SR) { return(SR.Regions.Where(R => R.CurrentPlayer != PlayerType.Me) .SelectMany(Target => Target.Neighbours).Distinct() .Where(N => N.CurrentPlayer == PlayerType.Me) .OrderByDescending(R => R.Neighbours.Count(N => N.CurrentPlayer == PlayerType.Opponent) * 2 + R.Neighbours.Count(N => N.CurrentPlayer == PlayerType.Neutral)).First()); }
/// <summary> /// Copy Current to Simulate /// </summary> /// <param name="superRegion"></param> public static void CopyCurrent2Simulate(SuperRegion superRegion) { superRegion.Regions.ForEach(R => { R.SimulateArmies = R.CurrentArmies; R.SimulatePlayer = R.CurrentPlayer; } ); }
/// <summary> /// Calculates if there are border territories with enemy armies in this super region /// </summary> /// <param name="superRegion">The super region.</param> /// <param name="allSuperRegions">All super regions.</param> /// <returns></returns> public static bool EnemyBorderTerritories(SuperRegion superRegion, SuperRegions allSuperRegions) { /* * Searches all border territories with neighbours occupied by the opponent * Then checks if these border territories are occupied by me OR have neighbours in the same super region that are occuped by me * */ return(superRegion.BorderTerritories .Where(bt => bt.Neighbours.Any(btn => btn.IsOccupiedBy(PlayerType.Opponent))) .Any(bt => (bt.IsOccupiedBy(PlayerType.Me)) || bt.Neighbours.Any(btn => btn.IsOccupiedBy(PlayerType.Me) && allSuperRegions.Get(btn) == superRegion))); }
/// <summary> /// Gets the stuck armies. /// </summary> /// <param name="superRegion">The super region.</param> /// <param name="transfers">The transfers.</param> /// <returns></returns> public static IEnumerable <Region> GetStuckArmies(SuperRegion superRegion, IEnumerable <ArmyTransfer> transfers) { return(superRegion .ChildRegions .Find(PlayerType.Me) .NoSourceYet(transfers) .NoTargetYet(transfers) .CanBeUsedForTransfer() .AllNeighboursOccupiedBy(PlayerType.Me)); }
/// <summary> /// Calculates if there are regions in this super region that are occupied by the opponent /// </summary> /// <param name="superRegion">The super region.</param> /// <returns></returns> public static bool EnemyRegions(SuperRegion superRegion) { /* * Searches all regions in this super region that are occupied by the opponent * Then checks if I have neighbours next to those enemy ergions * */ return(superRegion.ChildRegions .Where(region => region.IsOccupiedBy(PlayerType.Opponent)) .Any(region => region.Neighbours.Any(neighbour => neighbour.IsOccupiedBy(PlayerType.Me)))); }
public static List <PlaceArmies> SelectPlaceArmies() { // Commando List <PlaceArmies> PA = new List <PlaceArmies>(); // Find Mixed SuperRegions List <SuperRegion> sr_MIXED = Map.Current.SuperRegions .Where(sr => ((sr.StrategySuperRegion == StrategySuperRegionType.MixedHostile) || (sr.StrategySuperRegion == StrategySuperRegionType.MixedNeutral))).ToList(); if (sr_MIXED.Count > 0) { // Find SR with less regions to combat SuperRegion sr_BEST = sr_MIXED.OrderBy(sr => (sr.Regions.Count(R => R.CurrentPlayer != PlayerType.Me))).First(); // Region placeRegion = MixedRegion(sr_BEST); int placeArmies = Map.MapState.ReserveArmies(9999); placeRegion.CurrentArmies += placeArmies; PA.Add(new PlaceArmies(placeArmies, placeRegion)); } // Find SuperRegions with opponents if (Map.MapState.ArmiesAvailable() > 0) { IEnumerable <Region> Rs = Map.Current.Regions.Player(PlayerType.Me) .OrderByDescending(r1 => r1.Neighbours.Count(N => N.CurrentPlayer == PlayerType.Opponent)); if (Rs.Count() > 0) { Region placeRegion = Rs.First(); int placeArmies = Map.MapState.ReserveArmies(9999); placeRegion.CurrentArmies += placeArmies; PA.Add(new PlaceArmies(placeArmies, placeRegion)); } } // Find SuperRegions with neutral if (Map.MapState.ArmiesAvailable() > 0) { IEnumerable <Region> Rs = Map.Current.Regions.Player(PlayerType.Me) .OrderByDescending(r => r.Neighbours.Count(N => N.CurrentPlayer != PlayerType.Me)); if (Rs.Count() > 0) { Region placeRegion = Rs.First(); int placeArmies = Map.MapState.ReserveArmies(9999); placeRegion.CurrentArmies += placeArmies; PA.Add(new PlaceArmies(placeArmies, placeRegion)); } } return(PA); }
/// <summary> /// Calculates if the super region should be skipped /// </summary> /// <param name="superRegion">The super region.</param> /// <returns></returns> public static bool SkipSuperRegion(SuperRegion superRegion) { /* * Searches for regions in this super region that are occupied by me * Or, where I have regions nearby * */ return(superRegion .ChildRegions .None(region => region.IsOccupiedBy(PlayerType.Me)) && superRegion .ChildRegions .None(region => region.Neighbours.Any(n => n.IsOccupiedBy(PlayerType.Me)))); }
internal SuperRegionMin(SuperRegion superRegion, Player playerPerspective) { if (superRegion.Owner == null) { OwnerPerspective = OwnerPerspective.Unoccupied; } else if (superRegion.Owner == playerPerspective) { OwnerPerspective = OwnerPerspective.Mine; } else { OwnerPerspective = OwnerPerspective.Enemy; } Static = new SuperRegionMinStatic(superRegion); }
/// <summary> /// Calculates the strategy when there are no enemy regions in this super region. /// </summary> /// <param name="superRegion">The super region.</param> /// <returns></returns> public bool CalculateForNoEnemies(SuperRegion superRegion) { Region targetRegion = null, sourceRegion = null; bool transferDone = false; var targetRegions = StrategyManager.GetTargetRegions(superRegion, Transfers, TargetStrategy.ConquerAll); /* No neutral armies found in this super region, that should mean we own the continent. * Let's explore the world and go to a new super region * */ if (targetRegions.None()) { targetRegions = StrategyManager.GetTargetRegions(superRegion, Transfers, TargetStrategy.ConquerOtherSuperRegions); if (targetRegions.Any()) { //We'll want to make more than 1 move foreach (var cTargetRegion in targetRegions) { sourceRegion = StrategyManager.GetSourceRegion(cTargetRegion, Transfers, SourceStrategy.DominateOtherSuperRegions); transferDone = AddCurrentPairToTransferList(sourceRegion, cTargetRegion); } } else { targetRegions = StrategyManager.GetTargetRegions(superRegion, Transfers, TargetStrategy.EnemyInvasionPaths); targetRegion = targetRegions.FirstOrDefault(); if (targetRegion != null) { sourceRegion = StrategyManager.GetSourceRegion(targetRegion, Transfers, SourceStrategy.AttackEnemyInvasionPath); transferDone = AddCurrentPairToTransferList(sourceRegion, targetRegion); } } } // Neutral regions found in this super region else { StrategyManager.ConquerNeutralRegions(targetRegions, Transfers, SourceStrategy.DominateOtherSuperRegions); } return(transferDone); }
/// <summary> /// I07 /// The regions are given, with their parent superregion. /// </summary> /// <param name="parts"></param> public void Regions(String[] parts) { // Odd numbers are the region ids, even numbers are the superregion ids. for (int i = 2; i < parts.Length; i++) { int regionId = int.Parse(parts[i]); int superRegionId = int.Parse(parts[++i]); // Find SuperRegion object SuperRegion superRegion = Map.Current.SuperRegions .Find(sr => sr.Id == superRegionId); // Create Region and add to Map/SuperRegion Region region = new Region() { Id = regionId, SuperRegion = superRegion }; superRegion.Regions.Add(region); Map.Current.Regions.Add(region); } }
/// <summary> /// Calculates the super region borders. /// </summary> /// <param name="superregion">The superregion.</param> private void CalculateSuperRegionBorders(SuperRegion superregion) { //Calculate invasion paths and border territories for each Super Region var invasionPaths = superregion .ChildRegions .SelectMany(region => region .Neighbours .Where(neighbor => neighbor.SuperRegion.ID != superregion.ID)); var borderTerritories = superregion .ChildRegions .Where(region => region .Neighbours .Any(neighbor => neighbor.SuperRegion.ID != superregion.ID)); superregion.InvasionPaths = invasionPaths; superregion.BorderTerritories = borderTerritories; }
public void SuperRegion_ChildRegions() { //Arrange Region region = new Region() { ID = 1, IsWasteland = true, RegionStatus = RegionStatus.PossibleStartingRegion }; SuperRegion superregion = new SuperRegion() { ID = 1 }; //Act superregion.AddChildRegion(region); int childcount = superregion.ChildRegions.Count; //Assert Assert.IsTrue(childcount == 1); Assert.AreEqual(superregion.ChildRegions.First().ID, region.ID); Assert.AreEqual(superregion.ChildRegions.First().RegionStatus, region.RegionStatus); Assert.AreEqual(superregion.ChildRegions.First().IsWasteland, region.IsWasteland); }
/// <summary> /// Gets the target regions based on the given target strategy. /// </summary> /// <param name="superRegion">The super region.</param> /// <param name="allSuperRegions">All super regions.</param> /// <param name="transfers">The transfers.</param> /// <param name="targetStrategy">The target strategy.</param> /// <returns></returns> public static IEnumerable <Region> GetTargetRegions(SuperRegion superRegion, IEnumerable <ArmyTransfer> transfers, TargetStrategy targetStrategy) { IEnumerable <Region> targetRegions = new List <Region>(); switch (targetStrategy) { case TargetStrategy.ConquerCurrentSuperRegion: /* * Searches for regions in this super region that are not occupied (neutral) * Order by: * - Take regions away from the borders first * - Regions with neutral armies first, to ensure our expansion drift * - The amount of our regions nearby * */ targetRegions = superRegion .ChildRegions .OccupiedBy(PlayerType.Neutral) .OrderRegions(OrderStrategy.InternalFirst) .ThenOrderRegions(OrderStrategy.NeutralNeighboursFirst) .ThenOrderRegions(OrderStrategy.MostArmiesNearby); break; case TargetStrategy.ConquerAll: /* * Searches for regions in all super regions that are not occupied (neutral) * Order by: * - Take regions away from the borders first * - Regions with neutral armies first, to ensure our expansion drift * - The amount of our regions nearby * */ var internalRegions = superRegion .ChildRegions .OccupiedBy(PlayerType.Neutral); var externalRegions = superRegion .ChildRegions .OccupiedBy(PlayerType.Me) .SelectMany(region => region.Neighbours.Where(neighbour => neighbour.IsOccupiedBy(PlayerType.Neutral) && neighbour.SuperRegion != superRegion)); targetRegions = internalRegions.Concat(externalRegions) .OrderRegions(OrderStrategy.InternalFirst) .ThenOrderRegions(OrderStrategy.NeutralNeighboursFirst) .ThenOrderRegions(OrderStrategy.MostArmiesNearby); break; case TargetStrategy.ConquerOtherSuperRegions: /* * Searches for regions in other super regions that are not occupied (neutral) * */ targetRegions = superRegion .InvasionPaths .OccupiedBy(PlayerType.Neutral) .OrderRegions(OrderStrategy.MostArmiesNearby); break; case TargetStrategy.HostileRegions: /* * Searches for regions in this super region that are occupied by the opponent * */ targetRegions = superRegion .ChildRegions .OccupiedBy(PlayerType.Opponent) .AnyNeighboursOccupiedBy(PlayerType.Me) .OrderRegions(OrderStrategy.LeastNumberOfArmies); break; case TargetStrategy.EnemyInvasionPaths: /* * Searches for enemy invasion paths * Skip regions that are a target already, we should have conquered them already in earlier moves * */ targetRegions = superRegion .InvasionPaths .OccupiedBy(PlayerType.Opponent) .NoTargetYet(transfers) .OrderRegions(OrderStrategy.MostNumberOfArmies); break; } return(targetRegions); }
public SuperRegionMinStatic(SuperRegion superRegion) { Id = superRegion.Id; Bonus = superRegion.Bonus; }
/// <summary> /// Initialise /// </summary> /// <param name="superRegion">SuperRegion the simulation is about</param> /// <param name="connections">Consecutive conquers</param> public Simulation(SuperRegion superRegion, List <Connection> connections) { SuperRegion = superRegion; Connections = new List <Connection>(connections); }
// Initial map is given to the bot with all the information except for player and armies info public void SetupMap(string[] mapInput) { int i, regionId, superRegionId, reward; if (mapInput[1] == "super_regions") { for (i = 2; i < mapInput.Length; i++) { try { superRegionId = int.Parse(mapInput[i]); i++; reward = int.Parse(mapInput[i]); fullMap.Add(new SuperRegion(superRegionId, reward)); } catch (Exception e) { Console.Error.WriteLine("Unable to parse SuperRegions " + e); } } } else if (mapInput[1] == "regions") { for (i = 2; i < mapInput.Length; i++) { try { regionId = int.Parse(mapInput[i]); i++; superRegionId = int.Parse(mapInput[i]); SuperRegion superRegion = fullMap.GetSuperRegion(superRegionId); fullMap.Add(new Region(regionId, superRegion)); } catch (Exception e) { Console.Error.WriteLine("Unable to parse Regions " + e); } } } else if (mapInput[1] == "neighbors") { for (i = 2; i < mapInput.Length; i++) { try { Region region = fullMap.GetRegion(int.Parse(mapInput[i])); i++; String[] neighborIds = mapInput[i].Split(','); for (int j = 0; j < neighborIds.Length; j++) { Region neighbor = fullMap.GetRegion(int.Parse(neighborIds[j])); region.AddNeighbor(neighbor); } } catch (Exception e) { Console.Error.WriteLine("Unable to parse Neighbors " + e); } } } }
/// <summary> /// Calculates the strategy when there are enemy border territories. /// </summary> /// <param name="superRegion">The super region.</param> /// <returns></returns> public bool CalculateForEnemyBorderTerritories(SuperRegion superRegion) { Region targetRegion = null, sourceRegion = null; bool transferDone = false; var invadingBorderTerritories = StrategyManager.GetTargetRegions(superRegion, Transfers, TargetStrategy.EnemyInvasionPaths); var invadingBorderTerritory = invadingBorderTerritories.FirstOrDefault(); if (invadingBorderTerritory != null) { int enemyArmies = invadingBorderTerritory.NbrOfArmies; /* Let's see if we can attack. There is 60% change per attacking army. * We will be extra safe and use a 50% chance. * This means we'll need at least double as much armies as our opponent. * If this isn't the case, we'll send more armies to this region and defend our grounds. * * */ var possibleAttackingRegion = superRegion .ChildRegions .Find(PlayerType.Me) .Where(region => region.Neighbours.Contains(invadingBorderTerritory)) .Where(region => (region.NbrOfArmies >= enemyArmies * 2 || region.NbrOfArmies > Configuration.Current.GetMaximumTreshold()) && region.NbrOfArmies > 5) .OrderByDescending(region => region.NbrOfArmies) .FirstOrDefault(); //We can attack! if (possibleAttackingRegion != null) { targetRegion = invadingBorderTerritory; sourceRegion = possibleAttackingRegion; } /* We can't attack, so let's defend. * We'll send armies to the region that can be attacked with the least number of armies * We'll prefer sending from regions that can't be attacked. **/ else { targetRegion = invadingBorderTerritory .Neighbours .Find(PlayerType.Me) .Where(region => region.SuperRegion == superRegion) .OrderBy(region => region.NbrOfArmies) .FirstOrDefault(); if (targetRegion != null) { // Dont transfer from regions that have enemy neighbours sourceRegion = targetRegion .Neighbours .Find(PlayerType.Me) .Where(region => region.Neighbours.None(neighbour => neighbour.IsOccupiedBy(PlayerType.Opponent))) .OrderByDescending(region => region.NbrOfArmies) .FirstOrDefault(); } } transferDone = AddCurrentPairToTransferList(sourceRegion, targetRegion); var targetRegions = StrategyManager.GetTargetRegions(superRegion, Transfers, TargetStrategy.ConquerCurrentSuperRegion); StrategyManager.ConquerNeutralRegions(targetRegions, Transfers, SourceStrategy.DominateCurrentSuperRegion); } return(transferDone); }
/// <summary> /// Calculates the strategy when there are enemy regions in the super region /// </summary> /// <param name="superRegion">The super region.</param> /// <returns></returns> public bool CalculateForEnemyRegions(SuperRegion superRegion) { Region targetRegion = null, sourceRegion = null; bool transferDone = false; var hostileRegions = StrategyManager.GetTargetRegions(superRegion, Transfers, TargetStrategy.HostileRegions); if (hostileRegions.Any()) { foreach (var hostileRegion in hostileRegions) { int enemyArmies = hostileRegion.NbrOfArmies; /* Let's see if we can attack. There is 60% change per attacking army. * We will be extra safe and use a 50% chance. * This means we'll need at least double as much armies as our opponent. * If this isn't the case, we'll send more armies to this region and defend our grounds. * * */ var possibleAttackingRegion = Regions .Find(PlayerType.Me) .Where(region => region.Neighbours.Contains(hostileRegion)) .Where( region => (region.NbrOfArmies >= enemyArmies * 2 + 1 || region.NbrOfArmies > Configuration.Current.GetMaximumTreshold())) .OrderByDescending(region => region.NbrOfArmies) .FirstOrDefault(); //We can attack! if (possibleAttackingRegion != null) { targetRegion = hostileRegion; sourceRegion = possibleAttackingRegion; var nbrOfArmies = enemyArmies * 2; //If we're enclosed by ourself, attack with everything if (sourceRegion.Neighbours.Count(n => n.IsOccupiedBy(PlayerType.Me)) == sourceRegion.Neighbours.Count - 1) { nbrOfArmies = sourceRegion.NbrOfArmies - 1; } transferDone = transferDone || AddCurrentPairToTransferList(sourceRegion, targetRegion, nbrOfArmies); } /* We can't attack, so let's defend. * We'll send armies to the region that can be attacked with the least number of armies * We'll prefer sending from regions that can't be attacked. **/ else { targetRegion = hostileRegion .Neighbours .Find(PlayerType.Me) .Where(region => region.SuperRegion == superRegion) .OrderBy(region => region.NbrOfArmies) .FirstOrDefault(); if (targetRegion != null) { sourceRegion = targetRegion .Neighbours .Find(PlayerType.Me) .OrderByDescending(region => region.NbrOfArmies) .FirstOrDefault(); } else { //We can't defend a region, probably because we don't have armies nearby, so let's conquer some regions instead var targetRegions = StrategyManager.GetTargetRegions(superRegion, Transfers, TargetStrategy.ConquerCurrentSuperRegion); StrategyManager.ConquerNeutralRegions(targetRegions, Transfers, SourceStrategy.DominateCurrentSuperRegion); } } } } /* * There is a hostile region in this super regio but we can not attack it * Maybe we dont have enough armies nearby * So lets try doing something else, like conquering neutral armies */ else { var targetRegions = StrategyManager.GetTargetRegions(superRegion, Transfers, TargetStrategy.ConquerCurrentSuperRegion); StrategyManager.ConquerNeutralRegions(targetRegions, Transfers, SourceStrategy.DominateCurrentSuperRegion); } return(transferDone); }
/// <summary>Inits the default map.</summary> public static Map Init() { UnitTestMap map = new UnitTestMap(); SuperRegion northAmerica = new SuperRegion(1, 5, map); SuperRegion southAmerica = new SuperRegion(2, 2, map); SuperRegion europe = new SuperRegion(3, 5, map); SuperRegion afrika = new SuperRegion(4, 3, map); SuperRegion azia = new SuperRegion(5, 7, map); SuperRegion australia = new SuperRegion(6, 2, map); Region region1 = new Region(1, northAmerica); Region region2 = new Region(2, northAmerica); Region region3 = new Region(3, northAmerica); Region region4 = new Region(4, northAmerica); Region region5 = new Region(5, northAmerica); Region region6 = new Region(6, northAmerica); Region region7 = new Region(7, northAmerica); Region region8 = new Region(8, northAmerica); Region region9 = new Region(9, northAmerica); Region region10 = new Region(10, southAmerica); Region region11 = new Region(11, southAmerica); Region region12 = new Region(12, southAmerica); Region region13 = new Region(13, southAmerica); Region region14 = new Region(14, europe); Region region15 = new Region(15, europe); Region region16 = new Region(16, europe); Region region17 = new Region(17, europe); Region region18 = new Region(18, europe); Region region19 = new Region(19, europe); Region region20 = new Region(20, europe); Region region21 = new Region(21, afrika); Region region22 = new Region(22, afrika); Region region23 = new Region(23, afrika); Region region24 = new Region(24, afrika); Region region25 = new Region(25, afrika); Region region26 = new Region(26, afrika); Region region27 = new Region(27, azia); Region region28 = new Region(28, azia); Region region29 = new Region(29, azia); Region region30 = new Region(30, azia); Region region31 = new Region(31, azia); Region region32 = new Region(32, azia); Region region33 = new Region(33, azia); Region region34 = new Region(34, azia); Region region35 = new Region(35, azia); Region region36 = new Region(36, azia); Region region37 = new Region(37, azia); Region region38 = new Region(38, azia); Region region39 = new Region(39, australia); Region region40 = new Region(40, australia); Region region41 = new Region(41, australia); Region region42 = new Region(42, australia); region1.AddNeighbor(region2); region1.AddNeighbor(region4); region1.AddNeighbor(region30); region2.AddNeighbor(region4); region2.AddNeighbor(region3); region2.AddNeighbor(region5); region3.AddNeighbor(region5); region3.AddNeighbor(region6); region3.AddNeighbor(region14); region4.AddNeighbor(region5); region4.AddNeighbor(region7); region5.AddNeighbor(region6); region5.AddNeighbor(region7); region5.AddNeighbor(region8); region6.AddNeighbor(region8); region7.AddNeighbor(region8); region7.AddNeighbor(region9); region8.AddNeighbor(region9); region9.AddNeighbor(region10); region10.AddNeighbor(region11); region10.AddNeighbor(region12); region11.AddNeighbor(region12); region11.AddNeighbor(region13); region12.AddNeighbor(region13); region12.AddNeighbor(region21); region14.AddNeighbor(region15); region14.AddNeighbor(region16); region15.AddNeighbor(region16); region15.AddNeighbor(region18); region15.AddNeighbor(region19); region16.AddNeighbor(region17); region17.AddNeighbor(region19); region17.AddNeighbor(region20); region17.AddNeighbor(region27); region17.AddNeighbor(region32); region17.AddNeighbor(region36); region18.AddNeighbor(region19); region18.AddNeighbor(region20); region18.AddNeighbor(region21); region19.AddNeighbor(region20); region20.AddNeighbor(region21); region20.AddNeighbor(region22); region20.AddNeighbor(region36); region21.AddNeighbor(region22); region21.AddNeighbor(region23); region21.AddNeighbor(region24); region22.AddNeighbor(region23); region22.AddNeighbor(region36); region23.AddNeighbor(region24); region23.AddNeighbor(region25); region23.AddNeighbor(region26); region23.AddNeighbor(region36); region24.AddNeighbor(region25); region25.AddNeighbor(region26); region27.AddNeighbor(region28); region27.AddNeighbor(region32); region27.AddNeighbor(region33); region28.AddNeighbor(region29); region28.AddNeighbor(region31); region28.AddNeighbor(region33); region28.AddNeighbor(region34); region29.AddNeighbor(region30); region29.AddNeighbor(region31); region30.AddNeighbor(region31); region30.AddNeighbor(region34); region30.AddNeighbor(region35); region31.AddNeighbor(region34); region32.AddNeighbor(region33); region32.AddNeighbor(region36); region32.AddNeighbor(region37); region33.AddNeighbor(region34); region33.AddNeighbor(region37); region33.AddNeighbor(region38); region34.AddNeighbor(region35); region36.AddNeighbor(region37); region37.AddNeighbor(region38); region38.AddNeighbor(region39); region39.AddNeighbor(region40); region39.AddNeighbor(region41); region40.AddNeighbor(region41); region40.AddNeighbor(region42); region41.AddNeighbor(region42); map.Add(region1); map.Add(region2); map.Add(region3); map.Add(region4); map.Add(region5); map.Add(region6); map.Add(region7); map.Add(region8); map.Add(region9); map.Add(region10); map.Add(region11); map.Add(region12); map.Add(region13); map.Add(region14); map.Add(region15); map.Add(region16); map.Add(region17); map.Add(region18); map.Add(region19); map.Add(region20); map.Add(region21); map.Add(region22); map.Add(region23); map.Add(region24); map.Add(region25); map.Add(region26); map.Add(region27); map.Add(region28); map.Add(region29); map.Add(region30); map.Add(region31); map.Add(region32); map.Add(region33); map.Add(region34); map.Add(region35); map.Add(region36); map.Add(region37); map.Add(region38); map.Add(region39); map.Add(region40); map.Add(region41); map.Add(region42); map.Add(northAmerica); map.Add(southAmerica); map.Add(europe); map.Add(afrika); map.Add(azia); map.Add(australia); map.Finish(); return(map); }