当前位置: 首页>>代码示例>>C#>>正文


C# PlayerState.getCoins方法代码示例

本文整理汇总了C#中SevenWondersGUI.PlayerState.getCoins方法的典型用法代码示例。如果您正苦于以下问题:C# PlayerState.getCoins方法的具体用法?C# PlayerState.getCoins怎么用?C# PlayerState.getCoins使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SevenWondersGUI.PlayerState的用法示例。


在下文中一共展示了PlayerState.getCoins方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: playPrimary

        //please the primary card for the type baes AIs
        public Card playPrimary(PlayerState p, List<Card> hand)
        {
            int trade;
            for (int i = 0; i < hand.Count; i++)
            {
                if (hand[i].getType() == strategy)
                {
                    if (ResourceManager.GetInstance().ValidateCard(p, hand[i]))
                    {
                        //System.Console.WriteLine("ScienceStrategy():: getNextCard({0})", hand[i]);
                        p.addPlayedCards(hand[i]);
                        return hand[i];
                    }

                    trade = ResourceManager.GetInstance().validateTrade(p, hand[i], 0);

                    if ((trade > 0) && (p.getCoins() >= trade))
                    {
                        //.WriteLine(p.getName() + " trading for " + trade);
                        p.updateCoins(-trade);
                        ResourceManager.GetInstance().getGameState().getRightPlayer(p).updateCoins(trade);
                        p.addPlayedCards(hand[i]);
                        return hand[i];
                    }
                    trade = ResourceManager.GetInstance().validateTrade(p, hand[i], 1);

                    if ((trade > 0) && (p.getCoins() >= trade))
                    {
                        //Console.WriteLine(p.getName() + " trading for " + trade);
                        p.updateCoins(-trade);
                        ResourceManager.GetInstance().getGameState().getLeftPlayer(p).updateCoins(trade);
                        p.addPlayedCards(hand[i]);
                        return hand[i];
                    }
                }
            }
            return null;
        }
开发者ID:sunneh,项目名称:7Wonders,代码行数:39,代码来源:CommonAiFunc.cs

示例2: ValidateCard

        //Initial call to check for card validity
        public bool ValidateCard (PlayerState p, Card c)
        {
            //_logger.ValidatingCard(p, c);
            //_logger.CheckDictionary(p,hashtable);

            //Check for precards
            if (preCardCheck(p, c)) { return true; }

            // First check what the coin costs and total resource cost are            
            if (c.getCoinCost() == 0 && c.getTotalResourceCost() == 0)
            {
               //_logger.print(p,"Card dosn't cost anything");
                UpdateResources(p, c);
                return true;
            }

            // If the coin cost is not equal to 0 then does the player have enoguh coins ?
            if (c.getCoinCost() != 0 && c.getTotalResourceCost() == 0)
            {
               //_logger.CheckingCoins(p, c);                
                if (c.getCoinCost() <= p.getCoins())
                {
                    UpdateResources(p, c);
                    p.updateCoins(-c.getCoinCost());
                 //  _logger.CheckingPlayersCoins(p);                    
                    return true;
                }
                return false;
            }

            if (c.getTotalResourceCost() != 0)
            {
               //_logger.print(p,"Now we are working on the players Resources");
                return CheckResourceCost(p,c.getCost());
            }

            return false;
        }
开发者ID:sunneh,项目名称:7Wonders,代码行数:39,代码来源:ResourceManager+(Scott+Needham's+conflicted+copy+2013-04-05).cs

示例3: CheckingPlayersCoins

 public void CheckingPlayersCoins(PlayerState p)
 {
     if (Log(p))
         System.Console.WriteLine("[{0}] Player now has {1} coins", _class.GetType().Name, p.getCoins());     
 }
开发者ID:sunneh,项目名称:7Wonders,代码行数:5,代码来源:Logger.cs

示例4: CheckingCoins

 public void CheckingCoins(PlayerState p, Card c)
 {
     if (Log(p))
         Console.WriteLine("[{0}] Checking to see if we have enough coins: Cost {1} Has {2}"
                          , _class.GetType().Name
                          , c.getCoinCost()
                          , p.getCoins());
 }
开发者ID:sunneh,项目名称:7Wonders,代码行数:8,代码来源:Logger.cs

示例5: getNextCard

        public Card getNextCard(PlayerState p, List<Card> hand)
        {

            Random random = new Random();
            int randomNumber;
         
            Card c = null;
            if (ResourceManager.GetInstance().ValidateWonder(p))
            {
                randomNumber = random.Next(0, 2);
                Console.WriteLine("attempting to play wonder " + randomNumber);
                if (randomNumber == 1)
                {
                    Console.WriteLine("playing wonder " + randomNumber);
                    randomNumber = random.Next(0, hand.Count - 1);
                    c = hand[randomNumber];
                    p.setWonderCards(c);
                    p.getBoard().incrementWonderLevel(p);
                    
                }
            }

            List<int> availCards = new List<int>();
            for (int i = 0; i < hand.Count; i++)
            {
                availCards.Add(i);
            }

            int trade;
            //selects a card to play
            for (int i = 0; i < hand.Count; i++)
            {
                randomNumber = random.Next(0, availCards.Count - 1);
                c = hand[availCards[randomNumber]];
                if (ResourceManager.GetInstance().ValidateCard(p, c))
                {
                    p.addPlayedCards(c);
                    return c;
                    //Console.WriteLine("===================== CHECKED CARD ===========================");
                }
                trade = ResourceManager.GetInstance().validateTrade(p, c, 0);

                if ((trade > 0) && (p.getCoins() >= trade))
                {
                    //.WriteLine(p.getName() + " trading for " + trade);
                    p.updateCoins(-trade);
                    ResourceManager.GetInstance().getGameState().getRightPlayer(p).updateCoins(trade);
                    p.addPlayedCards(c);
                    return c;
                }
                trade = ResourceManager.GetInstance().validateTrade(p, c, 1);

                if ((trade > 0) && (p.getCoins() >= trade))
                {
                    //Console.WriteLine(p.getName() + " trading for " + trade);
                    p.updateCoins(-trade);
                    p.addPlayedCards(c);
                    ResourceManager.GetInstance().getGameState().getLeftPlayer(p).updateCoins(trade);
                    return c;
                }
                availCards.Remove(randomNumber);
                //Console.Write("RANDOM STRATEGY:: AGE :: ");
                //Console.WriteLine(ResourceManager.GetInstance().getGameState().getAge());

            }
            return null;
        }
开发者ID:sunneh,项目名称:7Wonders,代码行数:67,代码来源:RandomStrategy.cs

示例6: ValidateCard

        public bool ValidateCard (PlayerState p, Card c)
        {
           //_logger.ValidatingCard(p, c);
           //_logger.CheckDictionary(p,hashtable);

            //Get a list of preCards
            int[] preCard = c.getPreCard();
            //Go through list of preCards
            for (int i = 0; i < preCard.Length; i++)
            {
                //Check if preCard Value is valid
                if (preCard[i] < 150)
                {
                    //cycle through player's playedcards
                    for (int j = 0; j < p.getPlayedCards().Count; j++)
                    {//if the cards match then return true
                        if (p.getPlayedCards()[j].getNumber() == preCard[i]) { return true; }
                    }
                }
            }

            // First check what the coin costs and total resource cost are            
            if (c.getCoinCost() == 0 && c.getTotalResourceCost() == 0)
            {
               //_logger.print(p,"Card dosn't cost anything");
                UpdateResources(p, c);
                return true;
            }

            // If the coin cost is not equal to 0 then does the player have enoguh coins ?
            if (c.getCoinCost() != 0 && c.getTotalResourceCost() == 0)
            {
               //_logger.CheckingCoins(p, c);                
                if (c.getCoinCost() <= p.getCoins())
                {
                    UpdateResources(p, c);
                    p.updateCoins(-c.getCoinCost());
                 //  _logger.CheckingPlayersCoins(p);                    
                    return true;
                }
                return false;
            }

            if (c.getTotalResourceCost() != 0)
            {
               //_logger.print(p,"Now we are working on the players Resources");
                return CheckResourceCost(p,c);
            }

            return false;
        }
开发者ID:sunneh,项目名称:7Wonders,代码行数:51,代码来源:ResourceManager+(Sunny+Lee's+conflicted+copy+2013-04-04).cs

示例7: treasuryScore

 private int treasuryScore(PlayerState p) { return (p.getCoins() / 3); }
开发者ID:sunneh,项目名称:7Wonders,代码行数:1,代码来源:Score.cs

示例8: canAfford

 //CoinTransaction Check
 public bool canAfford(PlayerState p)
 {
     if (p.getCoins() < (coinTransactions[0] + coinTransactions[1]))
     {
         return false;
     }
     return true;
 }
开发者ID:sunneh,项目名称:7Wonders,代码行数:9,代码来源:ResourceManager.cs

示例9: ValidateCard

        /*
        * Input: A Player and a Card
        *
        * 
        * Output: True or False -> Does the player have enough resources to play given card already? 
        */
        public bool ValidateCard (PlayerState p, Card c)
        {
            //_logger.ValidatingCard(p, c);
            //_logger.CheckDictionary(p,hashtable);
            //c.toString();
            //Check for duplicity
            for (int i = 0; i < p.getPlayedCards().Count; i++)
            {
                if (c.getCardName() == p.getPlayedCards()[i].getCardName())
                {
                    if (p.getName().Equals("P0"))
                    {
                        System.Console.WriteLine("!Can't play card with the same name!");
                    }
                    return false; 
                }
            }

            //Check for precards
            if (preCardCheck(p, c)) { return true; }

            // First check what the coin costs and total resource cost are            
            if (c.getCoinCost() == 0 && c.getTotalResourceCost() == 0)
            {
               //_logger.print(p,"Card dosn't cost anything");
                UpdateResources(p, c);
                return true;
            }

            // If the coin cost is not equal to 0 then does the player have enoguh coins ?
            if (c.getCoinCost() != 0 && c.getTotalResourceCost() == 0)
            {
               //_logger.CheckingCoins(p, c);                
                if (c.getCoinCost() <= p.getCoins())
                {
                    UpdateResources(p, c);
                    p.updateCoins(-c.getCoinCost());
                 //  _logger.CheckingPlayersCoins(p);                    
                    return true;
                }
                return false;
            }

            if (c.getTotalResourceCost() != 0)
            {
               //_logger.print(p,"Now we are working on the players Resources");
                return CheckResourceCost(p,c.getCost());
            }

            return false;
        }
开发者ID:sunneh,项目名称:7Wonders,代码行数:57,代码来源:ResourceManager.cs

示例10: getNextCard

        public Card getNextCard(PlayerState p, List<Card> hand)
        {
            List<CivilianCard> civCards = new List<CivilianCard>();
            for (int i = 0; i < hand.Count; i++)
            {
                if (hand[i].getType() == 3)
                {
                    System.Console.WriteLine("CivilianStrategy():: getNextCard({0})", hand[i]);
                    civCards.Add((CivilianCard)hand[i]);
                }
            }

            // && (ResourceManager.GetInstance().ValidateCard(p, hand[i]))
            int trade;
            while (civCards.Count != 0)
            {
                CivilianCard bestCard = civCards[0];

                for (int i = 1; i < civCards.Count; i++)
                {
                    if (bestCard.getVictoryPoints() < civCards[i].getVictoryPoints())
                    {
                        bestCard = civCards[i];
                    }
                }
                if (ResourceManager.GetInstance().ValidateCard(p, bestCard))
                {
                    p.addPlayedCards(bestCard);
                    return bestCard;
                }

                trade = ResourceManager.GetInstance().validateTrade(p, bestCard, 0);

                if ((trade > 0) && (p.getCoins() >= trade))
                {
                    //.WriteLine(p.getName() + " trading for " + trade);
                    p.updateCoins(-trade);
                    ResourceManager.GetInstance().getGameState().getRightPlayer(p).updateCoins(trade);
                    p.addPlayedCards(bestCard);
                    return bestCard;
                }

                trade = ResourceManager.GetInstance().validateTrade(p, bestCard, 1);

                if ((trade > 0) && (p.getCoins() >= trade))
                {
                    //Console.WriteLine(p.getName() + " trading for " + trade);
                    p.updateCoins(-trade);
                    p.addPlayedCards(bestCard);
                    ResourceManager.GetInstance().getGameState().getLeftPlayer(p).updateCoins(trade);
                    return bestCard;
                }
                civCards.Remove(bestCard);
            }

            Card cur = ult.playSecondary(p, hand);
            if (cur != null)
            {
                return cur;
            }

            cur = ult.buildWonder(p, hand);
            if (cur != null)
            {
                return cur;
            }

            return ult.playAnyCard(p, hand);
        }
开发者ID:sunneh,项目名称:7Wonders,代码行数:69,代码来源:CivilianStrategy.cs

示例11: TradeCard

        private bool TradeCard(PlayerState p, Card c)
        {
            int trade = ResourceManager.GetInstance().validateTrade(p, c, 0);

            if ((trade > 0) && (p.getCoins() >= trade))
            {
                p.updateCoins(-trade);
                ResourceManager.GetInstance().getGameState().getRightPlayer(p).updateCoins(trade);
                p.addPlayedCards(c);
                return true;
            }
            trade = ResourceManager.GetInstance().validateTrade(p, c, 1);

            if ((trade > 0) && (p.getCoins() >= trade))
            {
                p.updateCoins(-trade);
                ResourceManager.GetInstance().getGameState().getLeftPlayer(p).updateCoins(trade);
                p.addPlayedCards(c);
                return true;
            }
            return false;
        }
开发者ID:sunneh,项目名称:7Wonders,代码行数:22,代码来源:AdaptiveStrategy.cs


注:本文中的SevenWondersGUI.PlayerState.getCoins方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。