Guest User

Untitled

a guest
Jan 22nd, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. int i, j, k, num_words, num_games;
  2. char game_board[SIZE][SIZE];
  3. FILE* ifp;
  4. ifp = fopen("dictionary.txt", "r");
  5. struct alphatreenode* dictionary = (struct alphatreenode*)malloc(sizeof(struct alphatreenode));
  6. dictionary->isWord = 0;
  7. for(i=0; i<26; i++){
  8. dictionary->nextLetter[i] = NULL;
  9. }
  10.  
  11. fscanf(ifp, "%d", &num_words);
  12.  
  13. for(i=0; i<num_words; i++){
  14. char word[20];
  15. fscanf(ifp, "%s", word);
  16. if(strlen(word) > 2 && strlen(word) < 17){
  17. //printf("Inserting: %s\n", word);
  18. insertWord(dictionary, word);
  19. //printf("Finished inserting.\n");
  20. }
  21. }
  22.  
  23. fclose(ifp);
  24. ifp = fopen("boggle.txt", "r");
  25. fscanf(ifp, "%d", &num_games);
  26. for(i=0; i<num_games; i++){
  27. for(j=0; j<SIZE; j++){
  28. for(k=0; k<SIZE; k++)
  29. fscanf(ifp, "%c", game_board[j][k]);
  30. }
  31. }
Add Comment
Please, Sign In to add comment