



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Project; Class: Full Course Title: Program Design and Development; Subject: COMPUTER SCIENCE; University: University of Arizona; Term: Spring 2000;
Typology: Study Guides, Projects, Research
1 / 5
This page cannot be seen from the preview
Don't miss anything!




http://www.cs.arizona.edu/classes/cs227/spring09/projects/BoggleWords
public class DiceTray {
// Constructor takes a 2D array of characters that represents the // Boggle DiceTray with 16 dice already rolled in a known fixed state. public DiceTray( char [][] array) { // TODO : Complete this method }
// Return true if search is in the Boggle DiceTray according to Boggle rules. // Note: This method does NOT check to see if the word is in the list of words. public boolean stringFound(String search) { // TODO : Complete this method return false ; } }
import static org.junit.Assert.*; import org.junit.Test; public class DiceTrayTest {
private char [][] tray = { {'A' 'B' 'C' 'D' } {'E' 'F' 'G' 'H' }, {'I' 'J' 'K' 'L' } {'M' 'N' 'O' 'P' } };
@Test public void testStringFindWhenThereStartingInUpperLeftCorner() { DiceTray dt = new DiceTray (tray); assertTrue (dt. stringFound ("ABC")); assertTrue (dt.stringFound("ABF")); assertTrue (dt.stringFound("ABC")); assertTrue (dt.stringFound("ABCD")); // ... assertTrue (dt.stringFound("ABFEJINM")); assertTrue (dt.stringFound("ABCDHGFEIJKLPONM")); assertTrue (dt.stringFound("ABCDHLPOKJNMIEFG")); }
@Test public void testStringFindWhenNotThere () { DiceTray dt = new DiceTray(tray); assertFalse (dt.stringFound("ACB")); assertFalse (dt.stringFound("AIE")); // ... }
@Test public void testStringFindWhenAttemptIsMadeToUseALetterTwice () { DiceTray dt = new DiceTray(tray); assertFalse (dt.stringFound("ABA")); assertFalse (dt.stringFound("ABB")); assertFalse (dt.stringFound("AEA")); // ... } }
Grading Criteria Iteraton 1 Due Tuesday 5-May 8:00 pm
// Return the dicetray as a string. public String getDiceTrayAsString() { return dicetray.toString(); }
// Given the list of words entered by the user let methods getScore() getWordsFound() // getWordsIncorrect() getWordsNotGuesssed() all return the correct values. public void prepareReport(List
// The score after the user quit. public int getScore() { // TODO : Complete this method }
// All words the user entered that count for the score. public Set
// All words the user entered that do not count for the score. public Set
// All words the user could have guessed but didn't public Set
must be case in sensitive
duplicates only count as one
incorrect words have no point reduction
Grading Criteria Iteraton 2 due Wednesday 5-May @ 5:00 pm