Example #1
0
        private Card SetStrategy(PlayerState p, List<Card> hand)
        {
            Card bestCard = null;
            int currentAge = ResourceManager.GetInstance().getGameState().getAge();

            if (p.getPlayedCards().Count() == 0)
                bestCard = BuildWonder(p, hand);

            if (bestCard == null)
                if (noOfPlayers == 3 || noOfPlayers == 7)
                    if (p.getBoard().getCurrentWonderLevel() != currentAge)
                        bestCard = BuildWonder(p, hand);

            if (bestCard == null)
                SetMilitaryStrategy(p, hand);

            if (bestCard == null)
                bestCard = SetScienceStrategy(p, hand);

            if (bestCard == null)
                bestCard = SetCommerceStrategy(p, hand);

            if (bestCard == null)
                bestCard = SetCivilianStrategy(p, hand);

            if (bestCard == null)
            {
                strategy = new RandomStrategy();
                bestCard = strategy.getNextCard(p, hand);
            }

            return bestCard;
        }
Example #2
0
 private Card SetScienceStrategy(PlayerState p, List<Card> hand)
 {
     if (noOfPlayers == 5 || noOfPlayers == 7)
         if (hand.Count() > 3)
         {
             strategy = new ScienceStrategy();
             return strategy.getNextCard(p, hand);
         }
     return null;
 }
 private Card SetScienceStrategy(PlayerState p, List <Card> hand)
 {
     if (noOfPlayers == 5 || noOfPlayers == 7)
     {
         if (hand.Count() > 3)
         {
             strategy = new ScienceStrategy();
             return(strategy.getNextCard(p, hand));
         }
     }
     return(null);
 }
        private Card SetStrategy(PlayerState p, List <Card> hand)
        {
            Card bestCard   = null;
            int  currentAge = ResourceManager.GetInstance().getGameState().getAge();

            if (p.getPlayedCards().Count() == 0)
            {
                bestCard = BuildWonder(p, hand);
            }

            if (bestCard == null)
            {
                if (noOfPlayers == 3 || noOfPlayers == 7)
                {
                    if (p.getBoard().getCurrentWonderLevel() != currentAge)
                    {
                        bestCard = BuildWonder(p, hand);
                    }
                }
            }

            if (bestCard == null)
            {
                bestCard = SetMilitaryStrategy(p, hand);
            }

            if (bestCard == null)
            {
                bestCard = SetScienceStrategy(p, hand);
            }

            if (bestCard == null)
            {
                bestCard = SetCommerceStrategy(p, hand);
            }

            if (bestCard == null)
            {
                bestCard = SetCivilianStrategy(p, hand);
            }

            if (bestCard == null)
            {
                strategy = new RandomStrategy();
                bestCard = strategy.getNextCard(p, hand);
            }

            return(bestCard);
        }
        private Card SetMilitaryStrategy(PlayerState p, List <Card> hand)
        {
            int         currentAge = ResourceManager.GetInstance().getGameState().getAge();
            PlayerState left       = ResourceManager.GetInstance().getGameState().getLeftPlayer(p);
            PlayerState right      = ResourceManager.GetInstance().getGameState().getRightPlayer(p);

            if ((left.getMilitaryPower() >= p.getMilitaryPower() - currentAge) ||
                (right.getMilitaryPower() >= p.getMilitaryPower() - currentAge))
            {
                strategy = new MilitaryStrategy();
                Card c = strategy.getNextCard(p, hand);
                return(c);
            }
            return(null);
        }
Example #6
0
        public Card playACard()
        {
            //System.Console.WriteLine(gameStrategy.Name());

            Card c = gameStrategy.getNextCard(this, hand);

            if (c == null)
            {
                c = gameStrategy.discardCard(this, hand);
                updateCoins(3);
            }
            getHand().Remove(c);
            setPlayedACard();
            return(c);
        }
Example #7
0
        public Card getNextCard(PlayerState p, List<Card> hand)
        {
            strategy = new MilitaryStrategy();

            Card c = strategy.getNextCard(p, hand);
            if (c == null)
            {
                strategy = new ScienceStrategy();
                c = strategy.getNextCard(p,hand);
            }

            if (c == null)
            {
                strategy = new CommerceStrategy();
                c = strategy.getNextCard(p, hand);            
            }

            return c;
        }
Example #8
0
        public Card getNextCard(PlayerState p, List <Card> hand)
        {
            strategy = new CivilianStrategy();

            Card c = strategy.getNextCard(p, hand);

            if (c == null)
            {
                strategy = new CommerceStrategy();
                c        = strategy.getNextCard(p, hand);
            }

            if (c == null)
            {
                strategy = new ScienceStrategy();
                c        = strategy.getNextCard(p, hand);
            }

            return(c);
        }
Example #9
0
        private Card SetMilitaryStrategy(PlayerState p, List<Card> hand)
        {
            int currentAge = ResourceManager.GetInstance().getGameState().getAge();
            PlayerState left = ResourceManager.GetInstance().getGameState().getLeftPlayer(p);
            PlayerState right = ResourceManager.GetInstance().getGameState().getRightPlayer(p);

            if ((left.getMilitaryPower() >= p.getMilitaryPower() - currentAge)
            || (right.getMilitaryPower() >= p.getMilitaryPower() - currentAge))
            {
                strategy = new MilitaryStrategy();
                Card c = strategy.getNextCard(p, hand);
                return c;
            }
            return null;
        }