int main(void) { puts("Random Testing Adventurer Card"); int numOfIteration = 500; int streamidx = 2; int randomseed = 1 + floor(Random() * (treasure_map + 1)); SelectStream(streamidx); PutSeed(randomseed); struct gameState G; int cnt, i, player; for (cnt = 0; cnt < numOfIteration; ++cnt) { //for (i = 0; i < sizeof(struct gameState); ++i) //((char*)&G)[i] = floor(Random()*256); // set a game G.numPlayers = 2; player = floor(Random() * 2); // number of players is 2 G.deckCount[player] = floor(Random() * MAX_DECK); G.discardCount[player] = floor(Random() * MAX_DECK); G.handCount[player] = floor(Random() * MAX_HAND); // set cards on the deck for (i = 0; i < G.deckCount[player]; ++i) G.deck[player][i] = floor(Random() * (treasure_map + 1)); // set cards discarded for (i = 0; i < G.discardCount[player]; ++i) G.discard[player][i] = floor(Random() * (treasure_map + 1)); // set cards on hand for (i = 0; i < G.handCount[player]; ++i) G.hand[player][i] = floor(Random() * (treasure_map + 1)); // test Adventurer Card testAdventurerCard(adventurer, &G, player, streamidx, randomseed); } printf("Random Testing Adventurer Card done..\n"); return 0; }
int main() { struct gameState G1; int p, i, n, s = 0; printf("Testing Card: Adventurer\n"); srand(time(NULL)); for (n = 0; n < 2000; n++) { for (i = 0; i < sizeof(struct gameState); i++) { ((char*)&G1)[i] = floor(Random() * 256); } p = floor(Random() * MAX_PLAYERS); G1.whoseTurn = p; G1.deckCount[p] = floor(Random() * MAX_DECK); G1.discardCount[p] = floor(Random() * MAX_DECK); G1.handCount[p] = floor(Random() * MAX_HAND); // change value 27 to variable treasure_map + 1 which also equals 27 for(i = 0; i < G1.deckCount[p]; i++){ G1.deck[p][i] = floor(Random() * (rand() % treasure_map + 1)); } for(i = 0; i < G1.handCount[p]; i++){ G1.hand[p][i] = floor(Random() * (rand() % treasure_map + 1)); } for(i = 0; i < G1.discardCount[p]; i++){ G1.discard[p][i] = floor(Random() * (rand() % treasure_map + 1)); } testAdventurerCard(p, &G1, &s); } printf("Successes: %d, Failures: %d\n", s, 2000 - s); return 0; }
int main() { return testAdventurerCard(); }
int main() { testAdventurerCard(); return 0; }