本文整理汇总了C#中SevenWondersGUI.PlayerState类的典型用法代码示例。如果您正苦于以下问题:C# PlayerState类的具体用法?C# PlayerState怎么用?C# PlayerState使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PlayerState类属于SevenWondersGUI命名空间,在下文中一共展示了PlayerState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetStrategy
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;
}
示例2: discardCard
public Card discardCard(PlayerState p, List<Card> hand)
{
for (int i = 0; i < hand.Count(); i++)
{
if (hand[i].getType() == 3)
return hand[i];
}
for (int i = 0; i < hand.Count(); i++)
{
if (hand[i].getType() == 4)
return hand[i];
}
for (int i = 0; i < hand.Count(); i++)
{
if ( hand[i].getType() == 1
|| hand[i].getType() == 2)
return hand[i];
}
Random r = new Random();
int index = r.Next(0, hand.Count);
return hand[index];
}
示例3: getNextCard
public Card getNextCard(PlayerState p, List<Card> hand)
{
Card cur = ult.playPrimary(p, hand);
if (cur != null)
{
return cur;
}
if(((p.getBoard().getName().Equals("WB1"))
|| (p.getBoard().getName().Equals("WB1"))
&& (p.getBoard().getCurrentWonderLevel() == 2))){
cur = ult.buildWonder(p, hand);
if (cur != null)
{
return cur;
}
}
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);
}
示例4: getNextCard
public Card getNextCard(PlayerState p, List<Card> hand)
{
noOfPlayers = ResourceManager.GetInstance().getGameState().getPlayers().Count();
Card c = SetStrategy(p, hand);
Console.WriteLine("[{0}] [{1}]", "Adaptive Strategy", strategy.Name());
return c;
}
示例5: 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());
}
示例6: SRCardInitializer
protected List<ResourceCard> SRCardInitializer(PlayerState p)
{
List<ResourceCard> tempList = new List<ResourceCard>();
for (int i = 0; i < p.getPlayedCards().Count; i++)
{
if ((p.getPlayedCards()[i].getNumber() > 7) && (p.getPlayedCards()[i].getNumber() < 14))
{ tempList.Add((ResourceCard)p.getPlayedCards()[i]); }
}
return tempList;
}
示例7: SetScienceStrategy
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;
}
示例8: getRightPlayer
public PlayerState getRightPlayer(PlayerState p)
{
if (p.getSeatNumber() == (players.Count-1))
{
return this.players[0];//first player
}
else
{
return this.players[(p.getSeatNumber() + 1)];
}
}
示例9: SetCivilianStrategy
private Card SetCivilianStrategy(PlayerState p, List<Card> hand)
{
for (int i = 0; i < hand.Count(); i++)
{
if (noOfPlayers == 3 || noOfPlayers == 7)
if (hand[i].getName() == "C22"
|| hand[i].getName() == "C23"
|| hand[i].getName() == "C63"
|| hand[i].getName() == "C64")
if (ResourceManager.GetInstance().ValidateCard(p, hand[i]))
{
strategy = new CivilianStrategy();
p.addPlayedCards(hand[i]);
return hand[i];
}
if (noOfPlayers == 3 || noOfPlayers == 6)
if (hand[i].getName() == "C24"
|| hand[i].getName() == "C25"
|| hand[i].getName() == "C108"
|| hand[i].getName() == "C109")
if (ResourceManager.GetInstance().ValidateCard(p, hand[i]))
{
strategy = new CivilianStrategy();
p.addPlayedCards(hand[i]);
return hand[i];
}
}
int vc = 0, index = 0;
for (int i = 0; i < hand.Count(); i++)
{
if (hand[i] is CivilianCard)
{
CivilianCard c = (CivilianCard)hand[i];
if (c.getVictoryPoints() > vc)
{
vc = c.getVictoryPoints();
index = i;
}
}
}
if (index != 0)
if (ResourceManager.GetInstance().ValidateCard(p, hand[index]))
{
strategy = new CivilianStrategy();
p.addPlayedCards(hand[index]);
return hand[index];
}
return null;
}
示例10: countCardType
public int countCardType(int cType, PlayerState pState)
{
int count = 0;
foreach (Card cCard in pState.getPlayedCards())
{
if (cCard.getType() == cType)
{
count++;
}
}
return count;
}
示例11: getLeftPlayer
public PlayerState getLeftPlayer(PlayerState p)
{
if (p == null) { Console.WriteLine("Snap: PlayerState is null"); }
if (p.getSeatNumber() == 0)
{
return this.players[players.Count-1];//last player
}
else
{
return this.players[(p.getSeatNumber()-1)];
}
}
示例12: 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;
}
示例13: getNextCard
public Card getNextCard(PlayerState p, List<Card> hand)
{
Card cur = ult.playPrimary(p, hand);
if (cur != null)
{
return cur;
}
//attempts to play wonder to increase science
if((p.getBoard().getName().Equals("WB3"))
&& (p.getBoard().getCurrentWonderLevel() < 2)
&& (ResourceManager.GetInstance().ValidateWonder(p))){
for (int i = 0; i < hand.Count; i++){
if(hand[i].getType() != 6){
p.setWonderCards(hand[i]);
p.getBoard().incrementWonderLevel(p);
return hand[i];
}
}
}
if((p.getBoard().getName().Equals("WB4"))
&& (p.getBoard().getCurrentWonderLevel() < 3)
&& (ResourceManager.GetInstance().ValidateWonder(p))){
for (int i = 0; i < hand.Count; i++){
if(hand[i].getType() != 6){
p.setWonderCards(hand[i]);
p.getBoard().incrementWonderLevel(p);
return hand[i];
}
}
}
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);
}
示例14: buildWonder
//attempts to build a wonder
public Card buildWonder(PlayerState p, List<Card> hand)
{
if (ResourceManager.GetInstance().ValidateWonder(p))
{
for (int i = 0; i < hand.Count; i++)
{
if (hand[i].getType() == strategy)
{
p.setWonderCards(hand[i]);
p.getBoard().incrementWonderLevel(p);
return hand[i];
}
}
return hand[0];
}
return null;
}
示例15: civScore
private int civScore(PlayerState p)
{
List<CivilianCard> civlist;
//Civilian Structures
civlist = new List<CivilianCard>();
int score = 0;
//Cycle through played cards
//Add all civilian cards to list
for (int i = 0; i < p.getPlayedCards().Count; i++) {
if (p.getPlayedCards()[i].getType() == 3) { civlist.Add((CivilianCard)p.getPlayedCards()[i]); }
}
//Cycle through civ card list to add points
for (int i = 0; i < civlist.Count; i++) {
score = score + civlist[i].getVictoryPoints();
}
return score;
}