本文整理汇总了C#中SevenWondersGUI.PlayerState.getBoard方法的典型用法代码示例。如果您正苦于以下问题:C# PlayerState.getBoard方法的具体用法?C# PlayerState.getBoard怎么用?C# PlayerState.getBoard使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SevenWondersGUI.PlayerState
的用法示例。
在下文中一共展示了PlayerState.getBoard方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: 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;
}
示例3: PlayerGameBoard
int g_index = 0;//needed to reset ZIndex to original value upon mouse events
public PlayerGameBoard(Grid gameGrid, PlayerState p, GameState g)
{
player = p;
parent = gameGrid;//only 1 child
if (parent.Children.Count > 1)//handle the case where there is existing child when we change views
{
parent.Children.Remove(parent.Children[1]);
//System.Console.WriteLine("Child Removed");
}
game = g;
if (game.getAge() == 4)//game is over
{
ScoreWindow s = new ScoreWindow(game, parent);
s.Show(); ;
}
playBoard = new Canvas();
parent.Children.Add(playBoard);//now child[1], two children
createCardStack("R", 179, 10, playBoard);//0-9
createCardStack("M", 336, 10, playBoard);//10-19
createCardStack("S", 493, 10, playBoard);//20-29
createCardStack("Civ", 650, 10, playBoard);//30-39
createCardStack("Com", 807, 10, playBoard);//40-49
createCardStack("G", 964, 6, playBoard);//50-55
createHandStack();//56-62
updateAge(game.getAge());//63
createWonderBoard(player.getBoard().getName());//64
createPlayerButtons();//65-71
createPlayerRedCircles();//72-78
createPlayerBlueCircles();//79-85
createMoveButtons();//86-89
updateMoney();//90
createWonderSpots(player.getBoard().getMaxWonderLevel());//[91-94] variable length
createRulesButton();//variable base on above wonder
updateWonderSpots(player.getWonderCards());
updateHand(player.getHand());
updateCards(player.getPlayedCards());
}
示例4: 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);
}
示例5: ResourceInitializer
//initial baseResources build up, SRCard initializer
protected int[] ResourceInitializer(PlayerState p) {
int[] rTotals = p.getBoard().getResources();
int[] tempResource = new int[7];
//Fill rTotals first, Wonder then Cards
//Cards
for (int i = 0; i < p.getPlayedCards().Count; i++)
{
//resource/manufactured good cards only
if ((p.getPlayedCards()[i].getType() == 1) || (p.getPlayedCards()[i].getType() == 2))
{
//remove optional resource cards from total
if ((p.getPlayedCards()[i].getNumber() < 7) || (p.getPlayedCards()[i].getNumber() > 14))
{
ResourceCard tempCard = (ResourceCard)p.getPlayedCards()[i];
System.Console.WriteLine("tempCard: " + tempCard.getResources());
addResources(rTotals,tempCard.getResources());
}
}
}
return rTotals;
}
示例6: CheckWonderBoard
public void CheckWonderBoard(PlayerState p)
{
if (Log(p))
{
Console.WriteLine("\n--------------------------------------------------------------------------------------------------------");
int[] resources = p.getBoard().getResources();
Console.WriteLine("[{0}] [Board.getResources ([{1}] [{2}])] ", _class.GetType().Name, p.getName(), p.getBoard().getName());
for (int index = 0; index < resources.Count(); index++)
{
Console.Write("[{0} : {1}] ", ((Resource)index).ToString(), resources[index]);
}
Console.WriteLine();
Console.WriteLine("--------------------------------------------------------------------------------------------------------\n");
}
}
示例7: validateTrade
/*
* Input: A Player, a Card and a direction(0 = right, 1 = left)
*
*
* Output: number of coins required to trade for resources for card with the player
* at the given direction. negitive number if impossible
*/
public int validateTrade(PlayerState p, Card c, int direction)
{
int recCost = 2;
int comCost = 2;
//checkes to see if a player can play card with thier own resources
if (ValidateCard(p, c))
{
return 0;
}
PlayerState trader;
if ((p.getBoard().getName().Equals("WB10")
&& (p.getBoard().getCurrentWonderLevel() >= 1)))
{
recCost = 1;
}
if (direction == 0)
{
trader = gameState.getRightPlayer(p);
for (int i = 0; i < p.getPlayedCards().Count; i++)
{
if ((p.getPlayedCards()[i].getNumber() == 31) ||
(p.getPlayedCards()[i].getNumber() == 32))
{
recCost = 1;
break;
}
}
}
else
{
trader = gameState.getLeftPlayer(p);
for (int i = 0; i < p.getPlayedCards().Count; i++)
{
if ((p.getPlayedCards()[i].getNumber() == 33) ||
(p.getPlayedCards()[i].getNumber() == 34))
{
recCost = 1;
break;
}
}
}
for (int i = 0; i < p.getPlayedCards().Count; i++)
{
if ((p.getPlayedCards()[i].getNumber() == 35) ||
(p.getPlayedCards()[i].getNumber() == 36))
{
comCost = 1;
}
}
if (!baseResources.ContainsKey(trader.getName()))
{
return -1;
}
int cost = 0;
List<int> traderResources = baseResources[trader.getName()];
int[] requiredResources = new int[c.getCost().Length];
for (int i = 0; i < c.getCost().Length; i++)
{
requiredResources[i] = c.getCost()[i];
requiredResources[i] -= baseResources[p.getName()][i];//p.getResources()[i];
if (requiredResources[i] < 0)
{
requiredResources[i] = 0;
}
if (traderResources[i] < requiredResources[i])
{
return -1;
}
if (i < 4)
{
cost += requiredResources[i] * recCost;
}
else
{
cost += requiredResources[i] * comCost;
}
Console.WriteLine("cost " + cost + " cur rec " + requiredResources[i]);
}
return cost;
}
示例8: CheckResourceCost
public bool CheckResourceCost(PlayerState p, Card c)
{
int[] totalResources = { 0, 0, 0, 0, 0, 0, 0 };
int[] cost = c.getCost();
int[] boardResources = p.getBoard().getResources();
List<int> playersResources = hashtable[p.getName()];
for (int i = 0; i < playersResources.Count(); i++)
{
totalResources[i] = (playersResources[i] + boardResources[i]);
}
var resources = Enum.GetValues(typeof(Resource));
foreach (var type in resources)
{
int resource = (int)type;
if (cost[resource] > totalResources[resource])
return false;
}
return true;
}
示例9: GetResources
public Resources GetResources(PlayerState p)
{
List<int> l = hashtable[gameState.getLeftPlayer(p).getName()];
List<int> r = hashtable[gameState.getRightPlayer(p).getName()];
List<int> c = hashtable[p.getName()];
// Get the wonder boards default resources
//_logger.CheckWonderBoard(p);
if (boardRAdded == false)
{
int[] br = p.getBoard().getResources();
for (int i = 0; i < br.Count(); i++)
c[i] = (br[i] + c[i]);
boardRAdded = true;
}
return new Resources(l.ToArray(), r.ToArray(), c.ToArray(), p.getName());
}
示例10: getNextCard
public Card getNextCard(PlayerState p, List<Card> hand)
{
PlayerState left = ResourceManager.GetInstance().getGameState().getLeftPlayer(p);
PlayerState right = ResourceManager.GetInstance().getGameState().getRightPlayer(p);
int age = ResourceManager.GetInstance().getGameState().getAge();
Card cur;
//Checks to see if AI has enough MilitaryPower to win the
//the battles at the end of the Age
if ((left.getMilitaryPower() >= p.getMilitaryPower() - age) ||
(right.getMilitaryPower() >= p.getMilitaryPower() - age))
{
cur = ult.playPrimary(p, hand);
if (cur != null)
{
return cur;
}
}
//attempts to play wonder to increase military
if ((p.getBoard().getName().Equals("WB7"))
&& (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("WB8"))
&& (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];
}
}
}
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);
}
示例11: ValidateWonder
//Initial call to check for wonder validity
public bool ValidateWonder(PlayerState p)
{
return CheckResourceCost(p, p.getBoard().getBuildCost(p.getBoard().getCurrentWonderLevel()));
}
开发者ID:sunneh,项目名称:7Wonders,代码行数:5,代码来源:ResourceManager+(Scott+Needham's+conflicted+copy+2013-04-05).cs
示例12: comScore
private int comScore(PlayerState p) {
int score = 0;
List<CommerceCard> comlist;
//Commercial Structure
comlist = new List<CommerceCard>();
//Cycle through played cards
//Add all Commerce cards to list
for (int i = 0; i < p.getPlayedCards().Count; i++)
{
if ((p.getPlayedCards()[i].getType() == 4) && (p.getPlayedCards()[i].getAct() == 3))
{
comlist.Add((CommerceCard)p.getPlayedCards()[i]);
}
}
for (int i = 0; i < comlist.Count; i++){
//Victorypoints per wonder
if (comlist[i].getPerWonder() == 2) { score = score + p.getBoard().getCurrentWonderLevel(); }
//Victorypoint per card
if((comlist[i].getCollect()[2] > 0)){
//crawl through all played cards of player
for (int j = 0; j < p.getPlayedCards().Count; j++)
{
//if card type matches victorypoint condition of commercial card
if (p.getPlayedCards()[j].getType() == comlist[i].getCollect()[0])
{
//add points appropriate to commercial card parameters
score = score + comlist[i].getCollect()[2];
}
}
}
}
return score;
//Guilds
}
示例13: WonderScore
private int WonderScore(PlayerState p) { return p.getBoard().getVictoryPoints(); }
示例14: ValidateWonder
/*
* Input: A Player
*
*
* Output: True or False -> Does the player have enough resources to add to their Wonder Board?
*/
public bool ValidateWonder(PlayerState p)
{
//System.Console.WriteLine(p.getName() + ":ValidateWonder");
if (p.getBoard().getCurrentWonderLevel() <p.getBoard().getMaxWonderLevel() )
return CheckResourceCost(p, p.getBoard().getBuildCost());
return false;
}
示例15: GuildScore
private int GuildScore(PlayerState p, GameState g)
{
int score = 0;
List<GuildCard> glist = new List<GuildCard>();
//GameState g = ;
//Cycle through played cards
for (int i = 0; i < p.getPlayedCards().Count; i++)
{
if (p.getPlayedCards()[i].getType() == Card._GUILD)
{
glist.Add((GuildCard)p.getPlayedCards()[i]);
}
}
//Cycle through guild cards
for (int i = 0; i < glist.Count; i++)
{
//worker
if (glist[i].getNumber() == 98) { score = score + (2 * (g.getLeftPlayer(p).countCardType(2) + g.getRightPlayer(p).countCardType(2)));}
//craft
if (glist[i].getNumber() == 99) { score = score + (g.getLeftPlayer(p).countCardType(1) + g.getRightPlayer(p).countCardType(1)); }
//trader
if (glist[i].getNumber() == 100) { score = score + (g.getLeftPlayer(p).countCardType(4) + g.getRightPlayer(p).countCardType(4)); }
//Philospher
if (glist[i].getNumber() == 101) { score = score + (g.getLeftPlayer(p).countCardType(6) + g.getRightPlayer(p).countCardType(6)); }
//Spies
if (glist[i].getNumber() == 102) { score = score + (g.getLeftPlayer(p).countCardType(5) + g.getRightPlayer(p).countCardType(5)); }
//strat
if (glist[i].getNumber() == 103) { score = score + (g.getLeftPlayer(p).getNumLosses()) + (g.getRightPlayer(p).getNumLosses());}
//ship
if (glist[i].getNumber() == 104) { score = score + (p.countCardType(1)) + (p.countCardType(2)) + (p.countCardType(7));}
//Science
if (glist[i].getNumber() == 105) { scienceguildCard = true; }
//magistrat
if (glist[i].getNumber() == 106) { score = score + (g.getLeftPlayer(p).countCardType(3) + g.getRightPlayer(p).countCardType(3)); }
//builders
if (glist[i].getNumber() == 107) {
score = score + (g.getRightPlayer(p).getBoard().getCurrentWonderLevel());
score = score + (g.getLeftPlayer(p).getBoard().getCurrentWonderLevel());
score = score + (p.getBoard().getCurrentWonderLevel());
}
}
return score;
}