CS 257: Software Design

WordGameAssistant, Phase 2 of 3

Continue with the partner you worked with to get set up in IntelliJ, Bitbucket, and git.

The other day in class, I asked you to suggest features for a program to help you with word games. Not surprisingly, most of the features centered on finding words with various arrangements of letters.

For the next phase of this project, you will develop core computational methods for the WordGameAssistant, along with JUnit tests to ensure the correctness of those methods. In the third and final phase of the project, you will build on the computational core to develop the command-line interface of a useful program.

The WordGameAssistant class

You will implement two classes: WordGameAssistant and WordGameAssistantTest. Each WordGameAssistant object will represent a list of "legal" words, and the methods provided by WordGameAssistant will provide a variety of types of queries a caller can perform on that list of words. For example, a Scrabble or Words With Friends player might want to ask "what's the longest word I can make out of these seven letters?" while someone working on a crossword puzzle might want to know "what five-letter words start with T and end in ST?"

The comments in WordGameAssistant.java describe the methods you need to implement during phase 3. Do not change the method signatures. You may create new private methods if that helps you implement the public methods, but don't change the public interface of the class at all.

The WordGameAssistantTest class, which is the focus of phase 2, is yours to implement as you see fit. It should consist of JUnit test cases, at least one per method in WordGameAssistant. (Though normally we would, don't worry about creating constructor unit tests. We would need to add some other stuff to WordGameAssistant to make that work, and it wouldn't add any value to the exercise.) For some of the methods, you may want to implement multiple tests for various boundary cases.

For most of the WordGameAssistant methods, you'll need access to a list of words to be considered legal for the games you're playing. You can use any word list you want for development purposes, but for grading purposes, we'll use a combination of tiny custom dictionary files and this big one, which I obtained somewhere forgotten about twenty years ago, and which I believe to be some version of SOWPODS, a word list used by many word game apps and non-US English Scrabble tournaments. Please do NOT add a large dictionary file to your repository. Just copy your dictionary file into the appropriate location in your clone as needed.

Required for phase 2

Your job for this part of the assignment is to implement a thorough collection of unit tests for the public methods in WordGameAssistant. Be creative, think about weird boundary cases, and don't be shy about creating lots of tests.

You do not have to implement the methods in WordGameAssistant. That's phase 3.

Notes about IntelliJ

To create your WordGameAssistantTest.java in IntelliJ: click on the word WordGameAssistant in the class declaration at the top of WordGameAssistant.java. IntelliJ should show you a little yellow lightbulb. Click on that and select "Create Test" and then use the wizard that pops up.

You may discover that when you first create your test file, the "@Test" lines show up in red to indicate an error. Click on Test to get the red lightbulb. Then click on the red lightbulb and select the option that adds JUnit to your classpath. You should never have to do that again for your installation of IntelliJ.

Handing it in

Submit your program by committing and pushing to your bitbucket repository and tagging the commit you want graded with a tag named "phase2".

Have fun!