Exemple #1
0
        public void buyDogsForAi()
        {
            for (int i = 0; i < pickedCountiesH.Count; i++)
            {
                int ownerID = int.Parse(pickedCountiesH[i].ownerID);
                int pos     = getPlayerPosById(ownerID);

                if (ownerID != 4)
                {
                    BuyDogResult temp = buyDogsAI(pickedCountiesH[i].income);
                    playersH[pos].addIncome(-temp.spentMoney);
                    playersH[pos].dogs += temp.boughtDogs;
                }
            }
        }
Exemple #2
0
        public BuyDogResult buyDogsAI(int income)
        {
            int _boughtDogs = 0;
            int _spentMoney = 0;

            if (income >= 250000)
            {
                int    spendable = (int)Math.Round(income * 0.2);
                double temp      = spendable / 100000;
                int    num       = (int)Math.Round(temp);

                _boughtDogs = num;
                _spentMoney = num * 100000;
            }

            BuyDogResult result = new BuyDogResult()
            {
                boughtDogs = _boughtDogs,
                spentMoney = _spentMoney
            };

            return(result);
        }