Example #1
0
int main()
{
	int i, j, p, position;
	struct gameState state;

	SelectStream(2);
	PutSeed(3);

	for (i = 0; i < 2000; i++)
	{
		for (j = 0; j < sizeof(struct gameState); j++)
		{
			((char*)&state)[j] = floor(Random() * 256);
		}
		p = floor(Random() * 4);

		position = floor(Random() * 20);
		state.deckCount[p] = floor(Random() * MAX_DECK);
		state.discardCount[p] = floor(Random() * MAX_DECK);
		state.playedCardCount = floor(Random() * MAX_DECK);
		state.handCount[p] = floor(Random() * MAX_HAND);
		state.whoseTurn = p;
		state.numActions = floor(Random() * 1);

		for (j = 0; j < treasure_map; j++)
		{
			state.supplyCount[j] = floor(Random() * 25);
		}

		for (j = 0; j < state.handCount[p]; j++)
		{
			state.hand[p][j] = floor(Random() * MAX_HAND);
		}

		for (j = 0; j < state.discardCount[p]; j++)
		{
			state.discard[p][j] = floor(Random() * MAX_DECK);
		}

		for (j = 0; j < state.deckCount[p]; j++)
		{
			state.deck[p][j] = floor(Random() * MAX_DECK);
		}

		for (j = 0; j < state.playedCardCount; j++)
		{
			state.playedCards[j] = floor(Random() * MAX_DECK);
		}

		testVillageCard(p, &state, position);
	}

	printf("No errors found in tests of Village Card \n");

	return 0;
}
Example #2
0
int main () {

	int i, n, player, players, cardPos; //, deckCount, discardCount, handCount;
	int CARDTYPES = 27;
	struct gameState G;
	printf ("Random Testing: Village Card Logic.\n");
	fflush(stdout);
	SelectStream(2);
	PutSeed(3);
	srand( time(NULL));

	for (n = 0; n < 2000; n++) {
		printf ("===============\n");
		printf ("Iteration %d.\n", n +1);
		printf ("===============\n");
		for (i = 0; i < sizeof(struct gameState); i++) {
			((char*)&G)[i] = floor(Random() * 256);
		}
	players = (((int)(Random()*10)) % 3) + 2;
	for(player=0; player <= players; player++)
	{
	  G.deckCount[player] = floor(Random() * MAX_DECK);
	  G.discardCount[player] = floor(Random() * MAX_DECK);
	  G.handCount[player] = floor(Random() * MAX_HAND);
	}
	for(player=0; player <= players; player++)
	{
		for(cardPos = 0; cardPos < MAX_HAND; cardPos++)
		{
		  G.hand[player][cardPos] = floor(Random() * CARDTYPES - 1);
		  G.discard[player][cardPos] = floor(Random() * CARDTYPES -1);
		  G.deck[player][cardPos] = floor(Random() * CARDTYPES -1);
		}
	}
	G.numActions = 1;
	G.playedCardCount = floor(Random() * MAX_DECK);
	G.whoseTurn = floor(Random() * players);
	testVillageCard(&G);
  }
  return 0;
}
Example #3
0
int main(){
  srand(time(NULL));
  testVillageCard();
  return 0;
}
Example #4
0
int main() {
	testVillageCard();
    return 0;
}