public Manager()
 {
     board = new Board();
     players = new List<Player>();
     dead = new List<Player>();
     random = new Random();
     shuffledTokens = new List<TerritoryToken>();
     am = new AlphaManager();
 }
 public object Clone()
 {
     Board ret = new Board();
     List<Continent> cloneContinents = new List<Continent>();
     foreach (Continent c in continents)
     {
         cloneContinents.Add((Continent)c.Clone());
     }
     List<Territory> cloneTerritories = new List<Territory>();
     foreach (Territory t in territories)
     {
         cloneTerritories.Add((Territory)t.Clone());
     }
     ret.continents = cloneContinents;
     ret.territories = cloneTerritories;
     return ret;
 }
 public override void TradeCards(Board board)
 {
     if (cards.Count > 2)
     {
         if (cards.Count > 5)
         {
             //force to trade
         }
         //ask to trade
     }
     //tell not enough cards
 }
        public Territory bestReinforce(Board board, Player player)
        {
            float best = 0;
            float territoryValue = 0;
            List<Territory> bestTerritories = new List<Territory>();
            Territory bestTerritory = null;
            Territory biggest = null;
            Board cloneBoard = (Board)board.Clone();
            Player clonePlayer = (Player)player.Clone();

            foreach (Territory t in clonePlayer.territories)
            {
                foreach (Territory adj in t.adjacent)
                {
                    if (adj.owner.name != clonePlayer.name)
                    {
                        if (biggest == null || adj.armies > biggest.armies)
                            biggest = adj;
                        if (adj.armies < t.armies)
                            territoryValue += 1 + alpha[0];
                        territoryValue += 1 + alpha[1];
                        Continent adjParent = getParentContinent(board, adj);
                        int ownedTerInCont = continentTerritoriesOwned(adjParent, t.owner);
                        if ((ownedTerInCont + 1) == adjParent.territories.Count || (ownedTerInCont + 2) == adjParent.territories.Count)
                            territoryValue += 5 + alpha[2];
                        if (adj.owner.territories.Count <= 4)
                            territoryValue += 3 + alpha[3];
                    }
                }
                if (biggest == null)
                    territoryValue += (0 - t.armies) + alpha[4];
                else
                    territoryValue += (biggest.armies - t.armies) + alpha[5];
                //Adds the corrisponding alpha value of the territories parent continent
                Continent parent = getParentContinent(board, t);
                switch (parent.name)
                {
                    case "North America":
                        territoryValue += alpha[10];
                        break;
                    case "South America":
                        territoryValue += alpha[11];
                        break;
                    case "Europe":
                        territoryValue += alpha[12];
                        break;
                    case "Africa":
                        territoryValue += alpha[13];
                        break;
                    case "Asia":
                        territoryValue += alpha[14];
                        break;
                    case "Australia":
                        territoryValue += alpha[15];
                        break;
                }
                //Add value if the reinforcement is next to the needed territory to complete a continent
                //Add value if the reinforcement is next to a players last reinforcement
                if (territoryValue > best)
                {
                    best = territoryValue;
                    bestTerritories.Clear();
                    bestTerritories.Add(t);
                }
                else if (territoryValue == best)
                {
                    bestTerritories.Add(t);
                }
                territoryValue = 0;
                biggest = null;
            }
            if (bestTerritories.Count > 1)
            {
                Random rand = new Random();
                int select = rand.Next(bestTerritories.Count);
                bestTerritory = bestTerritories[select];
            }
            else if (bestTerritories.Count < 1)
            {
                bestTerritories.Add(null);
                bestTerritories.Add(null);
            }
            else
            {
                bestTerritory = bestTerritories[0];
            }
            return bestTerritory;
        }
        public override void ReinforcementPhase(Board board)
        {
            //Repeats until all reinforcements are used
            while (reinforcements > 0)
            {
                //Asks for which territory they want to place on.
                //Console.WriteLine("Choose a territory to place armies on.");
                //Console.WriteLine("Remaining reinforcements: {0}", reinforcements);

                //Shows all territories
                for (int i = 0; i < territories.Count; i++)
                {
                    //Console.WriteLine((i + 1) + ". {0}, armies: {1}", territories[i].name, territories[i].armies);
                }

                //Gets input and grabs the appropriate territory
                int input = int.Parse(Console.ReadLine());
                Territory toPlaceOn = territories[(input - 1)];

                input = -1;
                //Asks how many armies to place on the territory
                while (input > reinforcements || input < 0)
                {
                    //Console.WriteLine("How many armies do you want to place on {0}?", toPlaceOn.name);
                    input = int.Parse(Console.ReadLine());
                }
                //Places the armies
                toPlaceOn.armies += input;
                reinforcements -= input;

            }
        }
 public abstract void GetReinforcements(Board board);
 public abstract void ReinforcementPhase(Board board);
Ejemplo n.º 8
0
        public override bool AttackPhase(Board board, List<Player> players, List<Player> dead)
        {
            //Make attack?
            //Perform attack
            Die die = new Die();
            int attackDice = 0;
            int defendDice = 0;
            List<Territory> attackTerritories = new List<Territory>();
            List<Territory> cloneTerritories = new List<Territory>();
            List<Territory> lastAttack = new List<Territory>();
            attackTerritories.Add(null);
            attackTerritories.Add(null);
            cloneTerritories.Add(null);
            cloneTerritories.Add(null);
            lastAttack.Add(null);
            lastAttack.Add(null);
            List<int> attackRolls = new List<int>();
            List<int> defendRolls = new List<int>();
            bool started = false;
            while (((attackTerritories[0] != null && attackTerritories[1] != null) || !started) && territories.Count != board.territories.Count)
            {
                //Console.WriteLine("{0} is thinking...", this.name);
                started = true;
                cloneTerritories.Clear();
                cloneTerritories = calculator.bestAttack(board, this);
                attackTerritories.Clear();
                if (cloneTerritories[0] == null && cloneTerritories[1] == null)
                    break;
                attackTerritories.Add(board.territories.Where(x => x.name == cloneTerritories[0].name).First());
                attackTerritories.Add(board.territories.Where(x => x.name == cloneTerritories[1].name).First());
                if (lastAttack[0] != null && lastAttack[1] != null)
                    if (attackTerritories[0].name == lastAttack[0].name &&
                       attackTerritories[1].name == lastAttack[1].name)
                        break;
                bool attackDone = false;

                while (!attackDone &&
                    attackTerritories[0].armies > 1 &&
                    attackTerritories[1].armies > 0 &&
                    territories.Count != board.territories.Count)
                {
                    lastAttack[0] = (Territory)attackTerritories[0].Clone();
                    lastAttack[1] = (Territory)attackTerritories[1].Clone();
                    if (attackTerritories[0].armies < attackTerritories[1].armies)
                        break;
                    //Console.WriteLine("Attacking {0} from {1}", attackTerritories[1].name, attackTerritories[0].name);
                    //Console.WriteLine("{0}: {1}\n{2}: {3}", attackTerritories[0].name, attackTerritories[0].armies, attackTerritories[1].name, attackTerritories[1].armies);
                    System.Threading.Thread.Sleep(0);
                    switch (attackTerritories[0].armies)
                    {
                        case 2:
                            attackDice = 1;
                            break;
                        case 3:
                            attackDice = 2;
                            break;
                        case 4:
                            attackDice = 3;
                            break;
                        default:
                            attackDice = 3;
                            break;
                    }

                    defendDice = attackTerritories[1].armies == 1 ? 1 : 2;

                    attackRolls = die.rollMultipleDice(attackDice).OrderByDescending(x => x).ToList();
                    defendRolls = die.rollMultipleDice(defendDice).OrderByDescending(x => x).ToList();

                    if (attackRolls[0] > defendRolls[0])
                    {
                        attackTerritories[1].armies--;
                    }
                    else
                    {
                        attackTerritories[0].armies--;
                    }
                    if (attackRolls.Count > 1 && defendRolls.Count > 1)
                    {
                        if (attackRolls[1] > defendRolls[1])
                        {
                            attackTerritories[1].armies--;
                        }
                        else
                        {
                            attackTerritories[0].armies--;
                        }

                    }
                    manager.vUpdateMap();
                    System.Threading.Thread.Sleep(0);
                    if (attackTerritories[0].armies < 2)
                        break;
                    else if (attackTerritories[1].armies < 1)
                    {
                        Player defeated = attackTerritories[1].owner;
                        //Console.WriteLine("{0} defeated {1} in {2} from {3}", this.name, defeated.name, attackTerritories[1].name, attackTerritories[0].name);
                        TakeOwnership(this, attackTerritories[1]);
                        attackTerritories[1].armies += attackRolls.Count;
                        attackTerritories[0].armies -= attackRolls.Count;

                        int halfAttack = attackTerritories[0].armies / 2;
                        if (halfAttack == 0)
                            halfAttack = 1;
                        if (attackTerritories[0].armies - 1 != 0)
                        {
                            attackTerritories[1].armies += halfAttack;
                            attackTerritories[0].armies -= halfAttack;
                        }

                        if (attackTerritories[0].armies == 0 ||
                            attackTerritories[1].armies == 0)
                            //Console.WriteLine("Something bad happened.");

                        attackDone = true;
                        manager.vUpdateMap();
                        System.Threading.Thread.Sleep(0);
                        if (defeated.territories.Count == 0)
                        {
                            foreach (Card card in defeated.cards)
                                cards.Add(card);
                            if (cards.Count > 4)
                                TradeCards(board);
                            //Console.WriteLine("{0} defeated!", defeated.name);
                            int toNull = players.IndexOf(defeated);
                            dead.Add((Player)players[toNull]);
                            players[toNull] = null;
                            System.Threading.Thread.Sleep(0);
                        }
                    }
                }

            }
            //Occupied?
            //Move armies
            //Player eliminated?
            //Take Cards
            //Trade if > 4
            return false;
        }
        public override bool AttackPhase(Board board, List<Player> players, List<Player> dead)
        {
            int input = -1;
            List<Territory> canAttack;
            List<Territory> attackableTerritories;
            Territory attacker;
            Territory defender;
            int attackDice = 0;
            int defendDice = 0;
            string output;
            int attackerLoss = 0;
            int defenderLoss = 0;

            //Sees if the player wants to attack
            while (input > 2 || input < 0)
            {
                //Console.WriteLine("Do you want to attack?\n1. Yes\n2. No");
                input = int.Parse(Console.ReadLine());
            }

            if (input == 1)
            {
                //Displays all territories that the player can attack from
                canAttack = territories.Where(x => x.armies > 1).ToList();
                input = -1;
                while (input > canAttack.Count || input < 0)
                {
                    //Console.WriteLine("Choose a territory to attack from?");
                    for (int i = 0; i < canAttack.Count; i++)
                    {
                        //Console.WriteLine("{0}. {1}: {2}", i + 1, canAttack[i].name, canAttack[i].armies);
                    }
                    input = int.Parse(Console.ReadLine());
                }

                attacker = canAttack[(input - 1)];

                input = -1;

                //Displays all the territories that the player can attack from the selected territory
                attackableTerritories = attacker.adjacent.Where(x => x.owner != attacker.owner).ToList();
                while (input > attackableTerritories.Count || input < 0)
                {
                    //Console.WriteLine("Choose a territory to attack?");
                    for (int i = 0; i < attackableTerritories.Count; i++)
                    {
                        //Console.WriteLine("{0}. {1}: {2}", i + 1, attackableTerritories[i].name, attackableTerritories[i].armies);
                    }
                    input = int.Parse(Console.ReadLine());
                }

                defender = attackableTerritories[(input - 1)];

                input = -1;

                //The roll loop
                while (input != 2)
                {
                    //Sees if the player wants to roll or retreat
                    //Console.WriteLine("1. Roll 2. Retreat\n{0}: {1}\n{2}: {3}", attacker.name, attacker.armies, defender.name, defender.armies);
                    input = int.Parse(Console.ReadLine());

                    if (input == 2)
                    {
                        input = -1;
                        break;
                    }
                    else
                    {
                        //Resets the input
                        input = -1;

                        //Rolls the dice and sets dice counts to max
                        Die die = new Die();
                        switch (attacker.armies)
                        {
                            case 2:
                                attackDice = 1;
                                break;
                            case 3:
                                attackDice = 2;
                                break;
                            default:
                                attackDice = 3;
                                break;
                        }
                        defendDice = defender.armies == 1 ? 1 : 2;

                        List<int> attackRolls = die.rollMultipleDice(attackDice).OrderByDescending(x => x).ToList();
                        List<int> defendRolls = die.rollMultipleDice(defendDice).OrderByDescending(x => x).ToList();

                        //Displays the attackers rolls
                        output = "Attacker: ";
                        for (int i = 0; i < attackRolls.Count - 1; i++)
                        {
                            output += attackRolls[i] + ", ";
                        }
                        output += attackRolls[attackRolls.Count - 1];
                        //Console.WriteLine(output);

                        //Displays the defenders rolls
                        output = "Defender: ";
                        for (int i = 0; i < defendRolls.Count - 1; i++)
                        {
                            output += defendRolls[i] + ", ";
                        }
                        output += defendRolls[defendRolls.Count - 1];
                        //Console.WriteLine(output);

                        //Calculates losses
                        if (attackRolls[0] > defendRolls[0])
                        {
                            defender.armies--;
                            defenderLoss++;
                        }
                        else
                        {
                            attacker.armies--;
                            attackerLoss++;
                        }
                        if (attackRolls.Count > 1 && defendRolls.Count > 1)
                        {
                            if (attackRolls[1] > defendRolls[1])
                            {
                                defender.armies--;
                                defenderLoss++;
                            }
                            else
                            {
                                attacker.armies--;
                                attackerLoss++;
                            }
                        }

                        //Displays the results of the skirmish
                        //Console.WriteLine("Attacker lost {0} armies and Defender lost {1} armies.", attackerLoss, defenderLoss);
                        attackerLoss = 0;
                        defenderLoss = 0;
                        if (attacker.armies < 2)
                        {
                            //Console.WriteLine("Not enough armies to attack.");
                            break;
                        }
                        else if (defender.armies < 1)
                        {
                            //Displays that you have conquered the territory
                            //Console.WriteLine("You defeated {0} in {1}.", defender.owner.name, defender.name);
                            Player defeated = defender.owner;

                            //Takes ownership and transfers the attacking armies
                            TakeOwnership(this, defender);
                            defender.armies += attackRolls.Count;
                            attacker.armies -= attackRolls.Count;

                            input = -1;
                            //Asks for how many armies to move mover
                            while (input > attacker.armies - 1 || input < 0)
                            {
                                //Console.WriteLine("How many armies do you want to move over?");
                                //Console.WriteLine("Available armies: {0}", attacker.armies - 1);
                                input = int.Parse(Console.ReadLine());
                            }

                            //Moves the armies over
                            attacker.armies -= input;
                            defender.armies += input;

                            //Console.WriteLine("{0}: {1}\n{2}: {3}", attacker.name, attacker.armies, defender.name, defender.armies);

                            //Checks to see if the opponent was eliminated
                            if (defeated.territories.Count == 0)
                            {
                                foreach (Card card in defeated.cards)
                                    cards.Add(card);
                                if (cards.Count > 4)
                                    TradeCards(board);
                                //Console.WriteLine("{0} defeated!", defeated.name);
                                int toNull = players.IndexOf(defeated);
                                dead.Add((Player)players[toNull].Clone());
                                players[toNull] = null;
                            }
                            input = 2;
                        }
                    }
                }
                return true;
            }
            else
                return false;
        }
Ejemplo n.º 10
0
 public override void PlaceReinforcement(Board board)
 {
     Territory toPlace = calculator.bestReinforce(board, this);
     if (toPlace == null)
     {
         Random rand = new Random();
         int select = rand.Next(territories.Count);
         toPlace = territories[select];
     }
     else
     {
         toPlace = territories.Where(x => x.name == toPlace.name).First();
     }
     toPlace.armies++;
     reinforcements--;
     //Select Territory
 }
Ejemplo n.º 11
0
 public override void ReinforcementPhase(Board board)
 {
     while (reinforcements > 0)
     {
         Territory toPlace = calculator.bestReinforce(board, this);
         if (toPlace == null)
         {
             Random rand = new Random();
             int select = rand.Next(territories.Count);
             toPlace = territories[select];
         }
         else
         {
             toPlace = territories.Where(x => x.name == toPlace.name).First();
         }
         toPlace.armies++;
         reinforcements--;
     }
     //While reinforcements are left
     //Select territory
     //Place armies
 }
Ejemplo n.º 12
0
        public override void FortifyPhase(Board board)
        {
            List<Territory> moveTerritories = calculator.bestMove(board, this);
            if (moveTerritories[0] != null && moveTerritories[1] != null)
            {
                moveTerritories[1].armies += moveTerritories[0].armies - 1;
                moveTerritories[0].armies = 1;
            }
            else
            {
                //Console.WriteLine("Making no move");
            }

            //Choose territory
            //Move armies
        }
 public Continent getParentContinent(Board board, Territory territory)
 {
     Continent parent = null;
     foreach (Continent c in board.continents)
     {
         foreach (Territory t in c.territories)
         {
             if (t.name == territory.name)
             {
                 parent = c;
                 break;
             }
         }
     }
     return parent;
 }
        public List<Territory> bestAttack(Board board, Player player)
        {
            float best = 0;
            float attackValue = 0;
            List<Territory> bestAttack = new List<Territory>();
            List<Territory> bestAttacks = new List<Territory>();
            Territory biggest = null;
            Board cloneBoard = (Board)board.Clone();
            Player clonePlayer = (Player)player.Clone();

            foreach (Territory t in clonePlayer.territories)
            {
                foreach (Territory adj in t.adjacent)
                {
                    if ((biggest == null || adj.armies > biggest.armies) && adj.owner.name != player.name)
                        biggest = adj;
                }
                foreach (Territory adj in t.adjacent)
                {
                    if (adj.owner.name != clonePlayer.name && t.armies > 1)
                    {
                        attackValue = (t.armies - adj.armies) + alpha[6];
                        if (playerOwnsContinent(getParentContinent(board, adj), adj.owner))
                        {
                            attackValue += 5 + alpha[7];
                        }
                        int contTerrOwned = continentTerritoriesOwned(getParentContinent(board, adj), t.owner);
                        if ((contTerrOwned + 1) == getParentContinent(board, adj).territories.Count || (contTerrOwned + 2) == getParentContinent(board, adj).territories.Count)
                        {
                            attackValue += 5 + alpha[8];
                        }

                        attackValue += ((float)contTerrOwned / (float)getParentContinent(board, adj).territories.Count) + alpha[9];

                        Continent parent = getParentContinent(board, adj);
                        switch (parent.name)
                        {
                            case "North America":
                                attackValue += alpha[10];
                                break;
                            case "South America":
                                attackValue += alpha[11];
                                break;
                            case "Europe":
                                attackValue += alpha[12];
                                break;
                            case "Africa":
                                attackValue += alpha[13];
                                break;
                            case "Asia":
                                attackValue += alpha[14];
                                break;
                            case "Australia":
                                attackValue += alpha[15];
                                break;
                        }

                        //if adj.owner contains all territories in that continent,
                        //add a large value to attack value.
                        //add continent ownership percentage
                        //if t.owner is missing only one from that continent and adj is it,
                        //add a large value to the attack value.
                        if (attackValue > best)
                        {
                            best = attackValue;
                            bestAttacks.Clear();
                            bestAttacks.Add(t);
                            bestAttacks.Add(adj);
                        }
                        else if (attackValue == best)
                        {
                            bestAttacks.Add(t);
                            bestAttacks.Add(adj);
                        }
                    }
                }
                biggest = null;
            }
            if (bestAttacks.Count > 2)
            {
                Random rand = new Random();
                int select = rand.Next((bestAttacks.Count / 2));
                bestAttack.Add(bestAttacks[select * 2]);
                bestAttack.Add(bestAttacks[(select * 2) + 1]);
            }
            else if (best < 1)
            {
                bestAttack.Clear();
                bestAttack.Add(null);
                bestAttack.Add(null);
            }
            else
            {
                bestAttack.Add(bestAttacks[0]);
                bestAttack.Add(bestAttacks[1]);
            }
            return bestAttack;
        }
 public abstract bool AttackPhase(Board board, List<Player> players, List<Player> dead);
Ejemplo n.º 16
0
        public override void FortifyPhase(Board board)
        {
            Territory toMoveFrom;
            Territory toMoveTo;
            int numArmiesToMove = 0;
            int input = -1;

            while (input > 2 || input < 0)
            {
                //Console.WriteLine("Do you want to fortify a territory?\n1. Yes\n2. No");
                input = int.Parse(Console.ReadLine());
            }

            if (input == 1)
            {
                input = -1;
                while (input > territories.Count || input < 0)
                {
                    //Asks for which territory they want to move to
                    //Console.WriteLine("Choose a territory to move armies from.");

                    //Shows all territories
                    for (int i = 0; i < territories.Count; i++)
                    {
                        //Console.WriteLine("{0}. {1}, available armies: {2}", i + 1, territories[i].name, territories[i].armies);
                    }
                    input = int.Parse(Console.ReadLine());
                }

                //Gets input and grabs the appropriate territory
                toMoveFrom = territories[(input - 1)];

                input = -1;
                //Asks how many armies to move to the territory
                while (input > toMoveFrom.adjacent.Count || input < 0)
                {
                    //Console.WriteLine("Choose a territory to move the armies to.");
                    for (int i = 0; i < toMoveFrom.adjacent.Count; i++)
                    {
                        //Console.WriteLine("{0}. {1}, armies: {2}", i + 1, toMoveFrom.adjacent[i].name, toMoveFrom.adjacent[i].armies);
                    }
                    input = int.Parse(Console.ReadLine());
                }
                toMoveTo = toMoveFrom.adjacent[(input - 1)];

                input = -1;
                while (input > toMoveFrom.armies - 1 || input < 0)
                {
                    //Console.WriteLine("How many armies do you want to move over?\n{0}-{1}", 0, toMoveFrom.armies - 1);
                    input = int.Parse(Console.ReadLine());
                }
                numArmiesToMove = input;

                //moves the armies
                toMoveFrom.armies -= numArmiesToMove;
                toMoveTo.armies += numArmiesToMove;
            }
        }
 public abstract void FortifyPhase(Board board);
Ejemplo n.º 18
0
        public override void GetReinforcements(Board board)
        {
            int min = 3;
            int total = territories.Count / 3;
            reinforcements += min > total ? min : total;

            foreach (Continent c in board.continents)
            {
                bool containsAll = true;
                foreach (Territory t in c.territories)
                {
                    if (!(territories.Contains(t)))
                    {
                        containsAll = false;
                        break;
                    }
                }
                if (containsAll)
                {
                    reinforcements += c.value;
                }
            }
        }
 public abstract void PlaceReinforcement(Board board);
Ejemplo n.º 20
0
        public override void PlaceReinforcement(Board board)
        {
            //Asks for which territory they want to place on.
            //Console.WriteLine("Choose a territory to place 1 army.");
            //Console.WriteLine("Remaining reinforcements: {0}", reinforcements);

            //Shows all territories
            for (int i = 0; i < territories.Count; i++)
            {
                //Console.WriteLine((i + 1) + ". {0}, armies: {1}", territories[i].name, territories[i].armies);
            }

            //Gets input and adds one army to that territory
            int input = int.Parse(Console.ReadLine());
            territories[(input - 1)].armies++;
            reinforcements--;
        }
 public abstract void TradeCards(Board board);
        public List<Territory> bestMove(Board board, Player player)
        {
            List<Territory> moveTerritories = new List<Territory>();
            Board cloneBoard = (Board)board.Clone();
            Player clonePlayer = (Player)player.Clone();
            List<Territory> isolatedTerritories = new List<Territory>();
            List<Territory> emptyIsolated = new List<Territory>();
            List<Territory> adjToIsolatedTerritories = new List<Territory>();
            bool isIsolated = true;

            List<Territory> bestTerritories = new List<Territory>();
            Territory bestTerritory = null;
            Territory bestIsolated = null;

            foreach (Territory t in clonePlayer.territories)
            {
                foreach (Territory adj in t.adjacent)
                {
                    if (adj.owner.name != clonePlayer.name)
                    {
                        isIsolated = false;
                    }
                }
                if (isIsolated && t.armies > 1)
                {
                    isolatedTerritories.Add(t);
                }
                else if (isIsolated && t.armies == 1)
                {
                    emptyIsolated.Add(t);
                }
                isIsolated = true;
            }

            if (isolatedTerritories.Count < 1)
            {
                moveTerritories.Add(null);
                moveTerritories.Add(null);
                return moveTerritories;
            }
            else
            {
                bestIsolated = null;
                foreach (Territory t in isolatedTerritories)
                {
                    if (bestIsolated == null || t.armies > bestIsolated.armies)
                        bestIsolated = t;
                    foreach (Territory adj in t.adjacent)
                    {
                        if (adj.owner.name == clonePlayer.name &&
                            !adjToIsolatedTerritories.Exists(x => x.name == adj.name) &&
                            !isolatedTerritories.Exists(x => x.name == adj.name))
                            adjToIsolatedTerritories.Add(adj);
                    }

                }
                moveTerritories.Clear();
                moveTerritories.Add(bestIsolated);

                foreach (Territory t in bestIsolated.adjacent)
                {
                    foreach (Territory adj in adjToIsolatedTerritories)
                    {
                        if (t.name == adj.name && !(emptyIsolated.Contains(adj)) && (bestTerritory == null || adj.armies < bestTerritory.armies))
                        {
                            bestTerritory = adj;
                        }
                    }
                }
                moveTerritories.Add(bestTerritory);
            }
            return moveTerritories;
        }