pangiann / hangman

Hangman is a paper and pencil guessing game for two or more players.
0 stars 0 forks source link

src: Add a new Dictionary Class #4

Closed pangiann closed 2 years ago

pangiann commented 2 years ago

Dictionary class builds a dictionary of words loaded from various descriptions found in millions of books from the Open Library. To specify the book from which this class will get the description a Book ID is used.

In a nuthsell, this class does the following:

  1. Checks if dictionary of same type/ID already exists.
  2. If yes:
    • Finds the path to the file
    • Loads the dictionary from the file
    • Validates the dictionary
    • Returns the newly created object for later use
  3. If not:
    • Gets the book's description using the ID
    • Processes description to create a valid dictionary
    • Saves it to a file
    • Returns the dictionary

Refs: https://github.com/pangiann/hangman/issues/1