/* * The main function is where everything starts. Choose a random * word and call one_game. Feel free to modify the words array, * but don't forget to modify the modulus (currently 4) for choosing * a random word from the array. */ int main() { srandom(time(NULL)); char *words[] = { "SUMMER", "AUTUMN", "WINTER", "SPRING" }; int word = random() % 4; one_game(words[word]); return 0; }
int main() { srandom(time(NULL)); int num_words = 0; wordnode *words = load_words("/usr/share/dict/words", &num_words); if (num_words == 0) { printf("Didn't load any words?!\n"); return 0; } printf("Words loaded: %d\n", num_words); const char *word = choose_random_word(words, num_words); printf("The random word is: %s\n", word); one_game(word); free_words(words); //printf("Evereyone is free!\n"); return 0; }
DWORD WINAPI thread_play(void *data) { int winner; int seed; seed = time(NULL); srand(seed); while(end == 0) { one_game(); SDL_Delay(1000); clear_window(); winner = is_end_game(); if (winner != -1) { end = 1; printf("%s\n", p[winner].name); } } }