Skip to content

Instantly share code, notes, and snippets.

@chancez
Created February 5, 2014 05:49
Show Gist options
  • Save chancez/8818050 to your computer and use it in GitHub Desktop.
Save chancez/8818050 to your computer and use it in GitHub Desktop.
200000: 646:int adventurer_effect(int currentPlayer, struct gameState *state){
-: 647: int cardDrawn;
200000: 648: int drawntreasure=0;
-: 649: int temphand[MAX_HAND];
200000: 650: int z = 0; // this is the counter for the temp hand
863581: 651: while(drawntreasure<2){
branch 0 taken 70%
branch 1 taken 30% (fallthrough)
463581: 652: if (state->deckCount[currentPlayer] <1){ //if the deck is empty we need to shuffle discard and add to deck
branch 0 taken 33% (fallthrough)
branch 1 taken 67%
153624: 653: shuffle(currentPlayer, state);
call 0 returned 100%
-: 654: }
463581: 655: drawCard(currentPlayer, state);
call 0 returned 100%
463581: 656: cardDrawn = state->hand[currentPlayer][state->handCount[currentPlayer]-1]; //top card of hand is most recently drawn card.
463581: 657: if (cardDrawn == copper || cardDrawn == silver || cardDrawn == gold)
branch 0 taken 39% (fallthrough)
branch 1 taken 61%
branch 2 taken 35% (fallthrough)
branch 3 taken 65%
branch 4 taken 0% (fallthrough)
branch 5 taken 100%
400000: 658: drawntreasure++;
-: 659: else{
63581: 660: temphand[z]=cardDrawn;
63581: 661: state->handCount[currentPlayer]--; //this should just remove the top card (the most recently drawn one).
63581: 662: z++;
-: 663: }
-: 664: }
463581: 665: while(z-1>=0){
branch 0 taken 24%
branch 1 taken 76% (fallthrough)
63581: 666: state->discard[currentPlayer][state->discardCount[currentPlayer]++]=temphand[z-1]; // discard all cards in play that have been drawn
63581: 667: z=z-1;
-: 668: }
200000: 669: return 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment