Exemplo n.º 1
0
int main () {
	int i;
	int k[10] = {adventurer, council_room, feast, gardens, mine,
			   remodel, smithy, village, baron, great_hall};
	struct gameState G;
	  
	printf ("Testing playCouncil_Room()\n"); 

	for (i = 0; i < 5; i++){
		memset(&G, 23, sizeof(struct gameState)); 
		initializeGame(2, k, 1, &G);
		G.hand[0][i] = council_room;
		testPlayCouncil_Room(i, &G);
	}
	
	memset(&G, 23, sizeof(struct gameState)); 
	initializeGame(2, k, 1, &G);
		
	for (i = 0; i < 5; i++){
		G.discard[0][G.discardCount[0]] = copper;
		G.discardCount[0]++;
	}
			
	for (i = 0; i < 4; i++)
		drawCard(0,&G);
	G.hand[0][0] = council_room;
	testPlayCouncil_Room(0, &G);
	
	printf("Done\n\n");
	return 0;
}
Exemplo n.º 2
0
int main()
{
	int p;
	int numTests = 600;
	struct gameState G;
	int handPos;
	int numPlayers;
	int maxPlayers = 5;
	int i, j, m, n, q, r, s;
/* 	int k[10] = {adventurer, council_room, feast, gardens, mine
		   , remodel, smithy, village, baron, great_hall}; */
	
	SelectStream(2);
	PutSeed(3);
	printf("Testing playing Council_Room cardtest4.\n");
	
	for(s = 0; s < numTests; s++)
	{
		for(numPlayers = 2; numPlayers < maxPlayers; numPlayers++)
		{
			for(p = 0; p < numPlayers; p++)
			{
				for (i = 0; i < sizeof(struct gameState); i++) { //from the lessons, random gameState
					((char*)&G)[i] = floor(Random() * 256);
				}
				//initializeGame(numPlayers, k, 1, &G);
				G.whoseTurn = p;
				G.numPlayers = numPlayers;
				
				//give cards to all players
				for(j = 0; j < numPlayers; j++)
				{
					G.handCount[j] = floor(Random() * MAX_HAND_TEST)+1;//need at least one village in our hand
					G.deckCount[j] = floor(Random() * MAX_DECK_TEST);
					G.discardCount[j] = floor(Random() * MAX_DECK_TEST);
					
					for(m = 0; m < G.handCount[j]; m++)
					{
						G.hand[j][m] = floor(Random() * treasure_map) + 1;
					}
					
					for(r = 0; r < G.discardCount[j]; r++)
					{
						G.discard[j][r] = floor(Random() * treasure_map) + 1;
					}

					for(n = 0; n < G.deckCount[j]; n++)
					{
						G.deck[j][n] = floor(Random() * treasure_map) + 1;
					}

				}
				
				//only current player has played cards
				G.playedCardCount = floor(Random() * MAX_DECK_TEST);
				for(q = 0; q < G.playedCardCount; q++)
				{
					G.playedCards[q] = floor(Random() * treasure_map) + 1;
				}	
				G.numBuys = 1; //not buying cards so any number will do
				handPos = floor(Random() * G.handCount[p]);//place council_room in a random pos
				G.hand[p][handPos] = council_room;
				
				testPlayCouncil_Room(&G, handPos);
				
			}
		}
	}
	
	printf("PLAY COUNCIL_ROOM TESTS FINISHED.\n\n");
	return 0;
}