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; }
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); }
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); }
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; }
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); }
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; }