int main(){ //initialize loop variables and value return variables int i, j, k, p, r; //seed our RNG for different combos of 3 empty piles srand(time(NULL)); //declare seed for RNG as initialize argument int seed = 19191; int numPlayers = 2; //declare player 1 (all tests are symmetric across players here) int player = 0; //set supply pile contents to anything, all that matters for this test //is their respective counts. int kingdom[10] = {adventurer, council_room, feast, gardens, mine , remodel, smithy, village, baron, great_hall}; struct gameState state; printf("Test for great hall card effect\n===================\n"); //initialize gamestate memset(&state, 0, sizeof(struct gameState)); r = initializeGame(numPlayers,kingdom,seed,&state); state.whoseTurn = player; assert(handActionIncrease(&state)==1); memset(&state, 0, sizeof(struct gameState)); r = initializeGame(numPlayers,kingdom,seed,&state); state.whoseTurn = player; assert(emptyDeck(&state)==1); memset(&state, 0, sizeof(struct gameState)); r = initializeGame(numPlayers,kingdom,seed,&state); state.whoseTurn = player; assert(discard(&state)==1); printf("All tests successful!\n\n"); return 0; }
void Deck::shuffle() { emptyDeck(); // Empty the deck so new cards can be added. vector<string> vect; set<string>::const_iterator iset; for(iset = cards.begin(); iset != cards.end(); iset++) { vect.push_back(*iset); } random_shuffle(vect.begin(), vect.end()); vector<string>::const_iterator ivect = vect.begin(); while(ivect != vect.end()) { deck.push(*ivect); ivect++; } }