Boggle has a web interface we've already built, which makes the setup a bit more involved than usual. Youll end up with a unique URL just for your boggle game. In order to setup the necessary files and folders to generate this URL, you will have to first create a directory (named whatever you want) somewhere in your home directory on the server.
The Assignment
This assignment is for the word game Boggle. Here's how the game works:
A board of letters is shaken up and laid out; then a timer is set.
A player tries to find all valid words. A "valid" word:
Can be constructed by sequentially adjacent cubes
Does not use the same cell twice in the same word
Has at least three letters
Is a dictionary word
In a "real world" Boggle, you might play against a friend, but for this program the human player will find all the words they possibly can. Then, your program will:
Validate the player's words and assigns points to them.
Solve the whole puzzle: list all the valid words in the board.
Building Block: The Dictionary Class
You'll need a dictionary class to read in words from the dictionary file and store them for later use. Youll need to use it to:
Insert a word from standard in (cin)
Given a word, determine if it is in the dictionary.
You'll build the dictionary class for Phase I of this project.
Submission -- Phase I
For the first week of this project, you'll work on building your dictionary. Dont worry about valgrind or validating input or anything like that (not until Phase II, anyway). We just want to make sure the basics are working as expected.
There are two text files for testing in /comp/15/files/bog-phase-one: test_input.txt and expected_output.txt, which you can copy as usual. There's also a dictionary file with about 270,000 words in it, so you might not want to make a copy of it. Instead, use a symbolic link: ln -s /comp/15/files/bog-phase-one/dictionary.txt .
Requirements for Phase I: Write a program that
Creates a dictionary object, using any data structure you would like. (Must be hash table with chaining)
Reads in all the words from dictionary.txt to populate the dictionary structure.
The dictionary file ends with "-1" sentinel, so look for that as a stopping point.
Reads in words from cin (one word at a time) and determines whether they are valid or not, using the output format we expect for the checker program. Print to standard out:
OK WORD // if word was found in the dictionary
NO WORD // if word was not found
Ensures that all the words (both from the dictionary and from the user's input) are case-insensitive. E.g., if I search for "Adulthood" in the dictionary, you should find it even though the entry is actually ADULTHOOD.
Makefile
Your makefile must compile with the command "make lookup" and generate an executable called lookup
We should be able to run your program with the command "./lookup dictionary.txt"
Here's how your program should look:
./lookup dictionary.txt Laney NO LANEY Strange OK STRANGE computer OK COMPUTER science OK SCIENCE compsci NO COMPSCI
Evaluating your phase one:
The test input file includes a list of phobias we found online. Some of the long clinical words are in the dictionary, and some aren't, so youll see a mix of "OK" and NO outputs.
We'll run your executable with the command ./lookup dictionary.txt < test_input.txt, and well expect the output to match expected_output.txt.
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference
and should not be submitted as is. We are not held liable for any misuse of the solutions.
Please see the frequently asked questions page
for further questions and inquiries.
Kindly complete the form.
Please provide a valid email address and we will get back to you within 24 hours.
Payment is through PayPal, Buy me a Coffee
or Cryptocurrency.
We are a nonprofit organization however we need funds to keep this organization operating
and to be able to complete our research and development projects.