CPSC 170 Post Lab 8
Evil Hangman
Due Before Class on Friday, March 18th


For this assignment you will create an evil version of the word game hangman. Normally in hangman, a word is selected that the player tries to guess one letter at a time. If the letter is in the word, all occurrences of the letter are revealed to the player. If the letter is not in the word, the player receives a penalty point. The game proceeds until the player either guesses the entire word or the penalty points reach a morbid threshold. You are going to create a version of hangman that cheats. It doesn't pick the word at the beginning, but rather in response to player guesses.


Create a command line version of hangman where instead of keeping track of the word the player is trying to guess, the program keeps track of a list of words, any of which are valid given the letters that the player has guessed. The program should read into a linked list all of the words in a word list file that are the length of the word the player is trying to guess. Note that some of the words may have capital letter's or apostrophes. Convert the capital letters to lower case and do not add the words with apostrophes. The tar file WordList.tar.gz contains several word list files (the ones with larger number suffixes contain more words). You can use your LinkedList class from lab, or the file LinkedList.java. Each time the player guesses a letter the program should compute the optimal word family for the player's guessed letter and remove all words from the linked list that are not in this family.

Word families are sets of words that have a specific letter in identical locations. For example, the words

boot boon pole bone hoot

belong to two different word families for the letter o. One family is words that contain o as the second and third letter (boot, boon, and hoot). The other family is words that contain o as the second letter (pole, bone). How many word families can there be for words of length 4? The goal of the program is to keep the linked list of words as large as possible. So, every time the player guesses a letter the program should compute the number of words currently in the linked list that are in each word family. Only one word family can be correct for the chosen letter, so it chooses the one with the most words in it by removing all words that do not belong to the largest family. Note if there are multiple largest families, it doesn't matter which is chosen as the largest as long as only one is chosen. After updating the list of potential words the program should display any letters that the player correctly guessed.

Submission: Tar and submit your code on the course Inquire site.


Create a graphical version of the program.