Project P7

Boggle Checker


Overview

Imagine you are part of a team developing a computer-based variation of the board game Boggle.  Boggle is a word game consisting of NxN grid of six-sided die where each side of a die has an upper case letter on it.  By shaking up the grid of die you end of with a random NxN grid of letters something like this:

X Q A E
Z O T S
I N D L
Y R U E

Next the players write down all of the words they find in the grid.  Words can occur forward, backward, up, down, diagonally, or "snake" through the board. For example, the grid above contains the words {IN, TO, RIND, TEA, TEASE} and possibly more.  Note that TEASE reuses the letter E - this is allowed.  The goal is to find the most words that no other player has found. A word must have more than one letter.
 
Your assignment on the team is to develop the word verification routine.  When a player guesses word, you have to determine if the word they guessed actually exists in the board.

Write a boolean function called checkWord that has a single String parameter representing the word to look for in the Boggle board.  You may write private helper methods if you choose.

Problem Requirements

Write a program to perform word verification for a Boggle game. 

You must follow this Java class definition:


public class BoggleChecker
{

/** Set the board for this checker.
 * @param board a String containing the letters in a 4x4 or 5x5 board
 * in row-major order. 

 * @pre board.length() is 16 or 25.
 * @pre board contains only upper case letters.
 */
public void setBoard(String board)

/** Determine if the given word exists in the current Boggle board.
 * @param word is a player's guess
 * @pre word contains only letters
 * @pre word.length() > 1
 * @pre a board has been set for this checker.
 */

public boolean checkWord(String word)

}

Note: Please design your own solution. While this algorithm is easy to find on the Web or in textbooks, please write your own algorithm from scratch.  Do not use the internet or other resources for any purpose related to games.  

Unit Testing

You must submit execution output that demonstrates that your program can produce the correct results for example in the overview above.  This output can be created in one of two ways:

Perform any additional tests you want to convince yourself that your solution is correct.

Acceptance Testing

In addition, your program must pass the instructor's acceptance test.  Once you are satisfied that your program is correct and is passing your unit tests, create a new time log entry.  Enter "Test" for the phase and in the comment field enter "Acceptance Testing".  (You may use "Accept Test" for the phase if you prefer.  Do not count this phase as development time in your summary).

Submit your source code using the Web-CAT grader. On this project the grader will not run your own unit tests. Web-CAT will report checkstyle errors in red and they WILL count in your total score. Each coding standard violation is a defect. The defect type is 10 for code syntax, and 80 for Javadoc errors. (Tip: To avoid getting style errors in Web-CAT, run the Checkstyle extension in BlueJ before submitting to Web-CAT.)

If Web-CAT reports any errors, tally them in a new section of the defect tally without an inject phase, with a removal phase of "ACCEPTANCE TEST". Don't add them to Injected Phase or total on the Summary form. You are allowed five Web-CAT submissions without penalty.  If you take more than five submissions, your project earns only half-credit.  

When Web-CAT assigns a 100% score to your work, you should finalize your work according to the assignment directions.