本文整理汇总了C#中SevenWondersGUI.PlayerState类的典型用法代码示例。如果您正苦于以下问题:C# PlayerState类的具体用法?C# PlayerState怎么用?C# PlayerState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PlayerState类属于SevenWondersGUI命名空间,在下文中一共展示了PlayerState类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:sunneh,项目名称:7Wonders,代码行数:33,代码来源:AdaptiveStrategy.cs
示例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];
}
开发者ID:sunneh,项目名称:7Wonders,代码行数:25,代码来源:AggressiveStrategy.cs
示例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);
}
开发者ID:sunneh,项目名称:7Wonders,代码行数:34,代码来源:CommerceStrategy.cs
示例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;
}
开发者ID:sunneh,项目名称:7Wonders,代码行数:7,代码来源:AdaptiveStrategy.cs
示例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());
}
开发者ID:sunneh,项目名称:7Wonders,代码行数:8,代码来源:Logger.cs
示例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;
}
开发者ID:sunneh,项目名称:7Wonders,代码行数:10,代码来源:resourceChecks.cs
示例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;
}
开发者ID:sunneh,项目名称:7Wonders,代码行数:10,代码来源:AdaptiveStrategy.cs
示例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)];
}
}
开发者ID:sunneh,项目名称:7Wonders,代码行数:11,代码来源:GameState.cs
示例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;
}
开发者ID:sunneh,项目名称:7Wonders,代码行数:54,代码来源:AdaptiveStrategy.cs
示例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;
}
开发者ID:sunneh,项目名称:7Wonders,代码行数:12,代码来源:KensUtilityfunctions.cs
示例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)];
}
}
开发者ID:sunneh,项目名称:7Wonders,代码行数:13,代码来源:GameState.cs
示例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;
}
开发者ID:sunneh,项目名称:7Wonders,代码行数:51,代码来源:ResourceManager+(Sunny+Lee's+conflicted+copy+2013-04-04).cs
示例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);
}
开发者ID:sunneh,项目名称:7Wonders,代码行数:47,代码来源:ScienceStrategy.cs
示例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;
}
开发者ID:sunneh,项目名称:7Wonders,代码行数:18,代码来源:CommonAiFunc.cs
示例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;
}
开发者ID:sunneh,项目名称:7Wonders,代码行数:17,代码来源:Score.cs
示例16: resourceChecks
//Base Constructor, Needs GameState and PlayerState
protected resourceChecks(GameState g, PlayerState p) {
//coinTransactions = new int[3]{0,0,0};
//Getting left and right player of player P
left = g.getLeftPlayer(p);
right = g.getRightPlayer(p);
//Initialize base resources
baseResources = ResourceInitializer(p);
lResources = ResourceInitializer(left);
rResources = ResourceInitializer(right);
//List of important resource cards
SRCardLst = SRCardInitializer(p);
lSRCardLst = SRCardInitializer(left);
rSRCardLst = SRCardInitializer(right);
}
开发者ID:sunneh,项目名称:7Wonders,代码行数:18,代码来源:resourceChecks.cs
示例17: incrementWonderLevel
// public int[] getResources() { return resources; }
public override void incrementWonderLevel(PlayerState p)
{
if(notMaxYet()){
currentWonderLevel++;
switch (currentWonderLevel)
{
case 1:
victoryPoints = 3;
return;
case 2:
p.updateCoins(9);
break;
case 3:
victoryPoints = 10;
break;
}
}
}
开发者ID:sunneh,项目名称:7Wonders,代码行数:21,代码来源:WB5.cs
示例18: incrementWonderLevel
//public int[] getResources() { return resources; }
public override void incrementWonderLevel(PlayerState p)
{
if(notMaxYet()){
currentWonderLevel++;
switch (currentWonderLevel)
{
case 1:
victoryPoints = 3;
break;
case 2:
freeBuild = true;
break;
case 3:
victoryPoints = 10;
break;
}
}
}
开发者ID:sunneh,项目名称:7Wonders,代码行数:21,代码来源:WB11.cs
示例19: incrementWonderLevel
//public int[] getResources() { return resources; }
public override void incrementWonderLevel(PlayerState p)
{
if(notMaxYet()){
currentWonderLevel++;
switch (currentWonderLevel)
{
case 1:
victoryPoints = 3;
return;
case 2:
resources = new int[7] {1,1,1,1,1,0,0};
break;
case 3:
victoryPoints = 10;
break;
}
}
}
开发者ID:sunneh,项目名称:7Wonders,代码行数:21,代码来源:WB1.cs
示例20: preCardCheck
/*
* Input: A Player and a Card
*
*
* Output: True or False -> Can the player play this card for free? If they have correct pre-card -> True
*/
private bool preCardCheck(PlayerState p, Card c)
{
//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; }
}
}
}
return false;
}
开发者ID:sunneh,项目名称:7Wonders,代码行数:25,代码来源:ResourceManager+(Geof+Tate's+conflicted+copy+2013-04-05).cs
注:本文中的SevenWondersGUI.PlayerState类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论