Mastery 2: CPS 108, Fall 1996

Due: December 9

Mastery exams are solo projects

This mastery exam is designed to give you some experience with programming in Java and in designing GUIs.

Boggling and Joggling

Boggle is a trademark of Parker Brothers. Joggle is the Java version of Boggle (note: there is a version of Joggle accessible at Gamelan. You can play the game, but you should not look at the source code --- you should be able to do much better than that version anyway.)

Boggle is a word game. Sixteen cubes (dice) have letters on each side. These are tossed, and a 4 x 4 grid provides the playing field for Boggle. Words are formed by connecting cubes that are adjacent either horizontally, vertically, or diagonally. For example, a board is shown below on the left with the word TRADES shaded in the board on the right.


In the basic version of Boggle, a letter cannot be re-used within a word. For example, the word SET can be formed in the board above, but the word SETS cannot be formed since the S cannot be re-used.

You are to write an application and an applet that allows the user to play boggle "against" the computer. For extra credit your program should be able to connect to a Joggle Server to allow several people to play against each other.


Your program will read a list of legal words, roll the letter cubes, and allow a user to type words. All words formed by the user should be added to a scrollable list box. A timer should inform the user how much time is left, initially allow two minutes to play the game, but this should be configurable. When the game is over, all words that the user missed should be shown in another listbox. If the user clicks on a word in either listbox, the letters that are used to form that word should be highlighted, or some how made more "visible".


You can optionally add the following features which will earn extra points.


A C definition for an array of Boggle cubes is shown below. This shows the actual cubes from a Boggle game (note: the 'Q' cube has a u with it that isn't shown below).

static char * cubes[] = { "forixb", "moqabj", "gurilw", "setupl", "cmpdae", "acitao", "slcrae", "romash", "nodesw", "hefiye", "onudtk", "tevign", "anedvz", "pinesh", "abilyt", "gkyleu" };

To find all the words on a Boggle board, the easiest method is to look up every word in the dictionary on the board (this may seem backwards, but it's easier to code and faster.) There will be more details on this as necessary.

You will be given a compressed boggle dictionary to use in your final program. However, initially you'll need to make your own dictionary of legal words. You may find /usr/dict/words a useful source. You might, for example, take the 3, 4, 5, and 6 letter words from it to use as your dictionary. The boggle dictionary will be made available next week.