本文整理汇总了C++中councilRoomCard函数的典型用法代码示例。如果您正苦于以下问题:C++ councilRoomCard函数的具体用法?C++ councilRoomCard怎么用?C++ councilRoomCard使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了councilRoomCard函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main() {
int handPos, currentPlayer, numPlayers;
struct gameState state;
for(handPos = 0; handPos < 100; handPos++){
for(currentPlayer = 0; currentPlayer < 10; currentPlayer++){
for(numPlayers= 0; numPlayers < 10; numPlayers++){
state.numPlayers = numPlayers;
councilRoomCard(&state, handPos, currentPlayer);
}
}
}
return 0;
}
开发者ID:CS362-Winter-2016,项目名称:cs362w16_watsonge,代码行数:14,代码来源:cardtest2.c
示例2: cardEffect
int cardEffect(int card, int choice1, int choice2, int choice3, struct gameState *state, int handPos, int *bonus)
{
int i;
int j;
int k;
int index;
int currentPlayer = whoseTurn(state);
int nextPlayer = currentPlayer + 1;
int tributeRevealedCards[2] = {-1, -1};
int drawntreasure=0;
if (nextPlayer > (state->numPlayers - 1)){
nextPlayer = 0;
}
//uses switch to select card and perform actions
switch( card )
{
case adventurer:
return adventurerCard (drawntreasure, state, currentPlayer);
case council_room:
return councilRoomCard (currentPlayer, state, handPos);
case feast:
return feastCard (currentPlayer, state, choice1);
case gardens:
return -1;
case mine:
return mineCard (currentPlayer, state, choice1, choice2, handPos);
case remodel:
return remodelCard (currentPlayer, state, choice1, choice2, handPos);
case smithy:
//+3 Cards
for (i = 0; i < 3; i++)
{
drawCard(currentPlayer, state);
}
//discard card from hand
discardCard(handPos, currentPlayer, state, 0);
return 0;
case village:
//+1 Card
drawCard(currentPlayer, state);
//+2 Actions
state->numActions = state->numActions + 2;
//discard played card from hand
discardCard(handPos, currentPlayer, state, 0);
return 0;
case baron:
state->numBuys++;//Increase buys by 1!
if (choice1 > 0){//Boolean true or going to discard an estate
int p = 0;//Iterator for hand!
int card_not_discarded = 1;//Flag for discard set!
while(card_not_discarded){
if (state->hand[currentPlayer][p] == estate){//Found an estate card!
state->coins += 4;//Add 4 coins to the amount of coins
state->discard[currentPlayer][state->discardCount[currentPlayer]] = state->hand[currentPlayer][p];
state->discardCount[currentPlayer]++;
for (;p < state->handCount[currentPlayer]; p++){
state->hand[currentPlayer][p] = state->hand[currentPlayer][p+1];
}
state->hand[currentPlayer][state->handCount[currentPlayer]] = -1;
state->handCount[currentPlayer]--;
card_not_discarded = 0;//Exit the loop
}
else if (p > state->handCount[currentPlayer]){
if(DEBUG) {
printf("No estate cards in your hand, invalid choice\n");
printf("Must gain an estate if there are any\n");
}
if (supplyCount(estate, state) > 0){
gainCard(estate, state, 0, currentPlayer);
state->supplyCount[estate]--;//Decrement estates
if (supplyCount(estate, state) == 0){
isGameOver(state);
}
}
card_not_discarded = 0;//Exit the loop
}
else{
p++;//Next card
}
}
}
else{
/* MUTANT (rep_op) */ if (supplyCount(estate, state) < 0){
gainCard(estate, state, 0, currentPlayer);//Gain an estate
state->supplyCount[estate]--;//Decrement Estates
if (supplyCount(estate, state) == 0){
isGameOver(state);
}
}
}
//.........这里部分代码省略.........
开发者ID:cs362sp16,项目名称:cs362sp16_minnerp,代码行数:101,代码来源:mutant101490_dominion.c
示例3: main
int main() {
srand(time(NULL));
int gameSeed = rand() % 1000 + 1;
int p = 0; //player 1
int numPlayer = 4;
int k[10] = {adventurer, council_room, feast, gardens, mine,
remodel, smithy, village, baron, great_hall};
struct gameState* GS = newGame();
initializeGame(numPlayer, k, gameSeed, GS);
GS->hand[p][4] = council_room; //5th card in hand is council room
printf("Playing Council Room card and testing...\n");
/*Checking handcount and cards in hand before playing council room*/
printf("Hand count before council room is %d...\n", GS->handCount[p]);
int i = 0, cardStatus;
char c[25];
for(i = 0; i < GS->handCount[p]; i++){
cardNumToName(GS->hand[p][i], c); //Converts card number to string
printf( "%s, ", c);
if(strcmp(c, "Council Room") == 0){
cardStatus = 1; //Card is present in hand
}
}
/*Check if council room card is in hand before use*/
if(cardStatus == 1){
printf("\nTest PASSED, card is present in player %d's hand\n\n", p);
} else {
printf("\nTest FAILED, card is NOT present in player %d's hand\n\n", p);
}
councilRoomCard(p, GS, 4); //Play council room card
cardStatus = 0; //Reset to zero
/*Checking handcount and cards in hand after playing council room*/
printf("Hand count after council room is %d...\n", GS->handCount[p]);
for(i = 0; i < GS->handCount[p]; i++){
cardNumToName(GS->hand[p][i], c); //Converts card number to string
printf( "%s, ", c);
if(strcmp(c, "Council Room") == 0){
cardStatus = 1; //Card is present in hand
}
}
/*Check if council room card is in hand*/
if(cardStatus == 0){
printf("\nTest PASSED, card is NOT present in player %d's hand\n\n", p);
} else {
printf("\nTest FAILED, card is present in player %d's hand\n\n", p);
}
printf("Testing for correct number of cards drawn...\n");
/*Check current state player's handcount +4 cards after discard is 8 cards*/
if(GS->handCount[p] == 8){
printf("Test PASSED, Player %d drew +4 cards\n\n", p);
} else {
printf("Test FAILED, Player %d drew incorrect amount of cards\n\n", p);
}
printf("Testing for correct number of numBuys...\n");
/*Check if numbuys is incremented*/
if(GS->numBuys == 2){
printf("Test PASSED, Player %d has +1 numBuys\n\n", p);
} else {
printf("Test FAILED, Player %d has incorrect number of numBuys\n\n", p);
}
printf("Checking if card is in played pile...\n");
/*Check if card is in played pile*/
if(GS->playedCards[p] == council_room){
printf("Test PASSED, Council Room is in played pile\n\n");
} else {
printf("Test FAILED, Council Room is NOT in played pile\n\n");
}
return 0;
}
开发者ID:Jmmyr41,项目名称:cs362f15,代码行数:84,代码来源:cardtest3.c
示例4: cardEffect
int cardEffect(int card, int choice1, int choice2, int choice3, struct gameState *state, int handPos, int *bonus)
{
int i;
int j;
int k;
int x;
int index;
int currentPlayer = whoseTurn(state);
int nextPlayer = currentPlayer + 1;
int tributeRevealedCards[2] = {-1, -1};
int temphand[MAX_HAND];// moved above the if statement
int drawntreasure=0;
int cardDrawn;
int z = 0;// this is the counter for the temp hand
if (nextPlayer > (state->numPlayers - 1)){
nextPlayer = 0;
}
//uses switch to select card and perform actions
switch( card )
{
case adventurer:
return adventurerCard(currentPlayer, state);
/* removed old adventurer code, replaced with function.
while(drawntreasure<2){
if (state->deckCount[currentPlayer] <1){//if the deck is empty we need to shuffle discard and add to deck
shuffle(currentPlayer, state);
}
drawCard(currentPlayer, state);
cardDrawn = state->hand[currentPlayer][state->handCount[currentPlayer]-1];//top card of hand is most recently drawn card.
if (cardDrawn == copper || cardDrawn == silver || cardDrawn == gold)
drawntreasure++;
else{
temphand[z]=cardDrawn;
state->handCount[currentPlayer]--; //this should just remove the top card (the most recently drawn one).
z++;
}
}
while(z-1>=0){
state->discard[currentPlayer][state->discardCount[currentPlayer]++]=temphand[z-1]; // discard all cards in play that have been drawn
z=z-1;
}
return 0;
*/
case council_room:
return councilRoomCard(currentPlayer, state, handPos);
/* removed old council_room code, replaced with call to function
//+4 Cards
for (i = 0; i < 4; i++)
{
drawCard(currentPlayer, state);
}
//+1 Buy
state->numBuys++;
//Each other player draws a card
for (i = 0; i < state->numPlayers; i++)
{
if ( i != currentPlayer )
{
drawCard(i, state);
}
}
//put played card in played card pile
discardCard(handPos, currentPlayer, state, 0);
return 0;
*/
case feast:
return feastCard(currentPlayer, state, choice1);
/* removed old feast code, replaced with call to function
//gain card with cost up to 5
//Backup hand
for (i = 0; i <= state->handCount[currentPlayer]; i++){
temphand[i] = state->hand[currentPlayer][i];//Backup card
state->hand[currentPlayer][i] = -1;//Set to nothing
}
//Backup hand
//Update Coins for Buy
updateCoins(currentPlayer, state, 5);
x = 1;//Condition to loop on
while( x == 1) {//Buy one card
if (supplyCount(choice1, state) <= 0){
if (DEBUG)
printf("None of that card left, sorry!\n");
//.........这里部分代码省略.........
开发者ID:LunkaiChen,项目名称:CS362Su2015,代码行数:101,代码来源:dominion.c
注:本文中的councilRoomCard函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论