Time requirements: Your program should be able to load the dictionary into your data structure in about a minute, and your computer player should decide what to play for a single turn in less than 10 seconds.
1 | (30) | Wednesday, 8th week | 8:00 AM | 3-4 page document describing the data structures and
algorithms you plan to use for finding the best word to play. Probably will focus on the Scrabble and Scrabble dictionary
classes, and other classes used by them. Include UML class
diagram. Should also include a description of your GUI
enhancements:
For example, how will human player indicate what letters to play
where? Submit to a drop box on ANGEL. |
|
2 | (50) | Friday, 9th week | 8:00 AM | Rubric | Working, well-documented code for a human player, ability to load and save games. Commit to your repository. |
3 | (150) | Wednesday, 10th week | 8:00 AM | Rubric | Final, well-documented code for both human and computer players. Commit to your repository. |
4 | (30) | Thursday, 10th week | in-class | Rubric | ≤ 7-minute presentation about your algorithms and data structures. May include a demo, if your program has unique features. |
5 | (30) | Thursday, 10th week | Noon | Performance evaluation of team members, including yourself. |
Writing a GUI for Scrabble from scratch would be an interesting and enlightening thing to do, but we want you to focus on the course's title, Data Structures and Algorithms. While you are welcome to be creative and produce your own user interface, this is not required. We have provided a basic user interface which you can extend in various ways. But of course you can write your own if you prefer.
The starting code that we providing for you (ScrabbleFrame.java and other classes that it uses) already allows you to display a board and load a game file. It calls the ScrabbleDictionary constructor to build a dictionary object for the game to use. At this point that constructor does not actually build a dictionary. That is one of your main tasks.
THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE. But even if it
has a bug or two, hopefully you will find it a lot easier than
writing your own from scratch!
There are a few new GUI features (widgets) that you should add (as buttons, menu items, or something). The names I give here do not have to be the words that the user sees; they are meant to convey the idea of the functionality needed. Not all of these will be relevant to all of the modes; ideally thay should only appear in relevant modes.
.scrabble
form. This code already exists, but only
works for H mode. You need to make it work for the other
nodes also.Important note: The Scrabble, TestCases, GameState, and ScrabbleDictionary classes know nothing about the GUI. This separation of functionality is A Good Thing, and we insist that you maintain it. For example, it is possible to write tests of these classes that are independent of any GUI.
The Scrabble class is the brains of the operation. It (and any classes that you write to assist it in its work) maintains the state of the came, checks for legal plays, calculates scores, and chooses a play for the computer player.
A ScrabbleDictionary object contains your efficient data structure for accessing the dictionary in ways that your Scrabble class needs to access it. It is constructed from a .sd file, a text file which contains one word per line.
A GameState object contains the dynamic information about the result of a play. Basically it is what a GUI needs to know in order to properly update itself. Must be modified to accommodate 2-player game.
One of the Scrabble constructors reads a .scrabble file and creates a Scrabble object that represents a saved game.
The provided dictionary data file, dictionary01.sd, is one that we found online. It is a combination of the 95% SCOWL list that we used in Doublets and the 2- and 3-letter words from the official Scrabble dictionary, as reported here.
Some sample saved games are provided in the ScrabbleFiles folder.
Javadoc documentation for the prvided classes is provided in your repository, and also here. May be slightly out-of-date.
Important note: Your team is not required to use any of the provided code, or even the same class names. You may modify or replace any of the code, or throw it all away and start "from scratch" if you wish.
The first line in the file must contain 3 items, separated by spaces. These are the maximum hand size (7 in the example), the board dimension (you can always assume 15, due to how we wrote the provided GUI), and the player mode (2, H, or C, representing 2-player, human-only, computer-only, respectively).
The contents of the second line vary according to the mode from the first line
T – triple word score
t – triple letter score
D – double word score
d – double letter score
* - center space that must be used on first move (this is also a double word score space)
Immediately after the board
configuration, the next N lines (once again N is the board dimension) will be the
current status of the board in regard to what letters are already on the board
and where.
The spaces in the picture are simply squares with no tiles, so
the first line in the example is 15 spaces, as is the second line and so
forth until there is BOO in the middle of a line..scrabble
file is represented by a lower-case p.
The last required line of the file represents the tile bag. These are the characters yet to be drawn; they are provided in the opposite of the order they will be drawn from the bag. This will make the ArrayList manipulation more efficient.
Do not insert any extra lines between the sections.The example shown as a file above and as a board below can be found in test03.scrabble. For this example, assume that the letters C, R and W were the last to be played. On that turn, the player earned points for each letter in CROW and in TOW (W will be counted twice). However, special squares only count if they are underneath the C, R or W.
Now suppose the board layout is the same as above, but a different set of letters
is in the player's hand: POSEDIE.
On the next play, the player might play S to the right of ROT, O to the right of
LO, and D to the right of CROW; this would earn points for playing the main
word SOD(8 points), and for the additional words ROTS(4 points), LOO(3 points), and CROWD(15
points). Once again,
double or triple scores only count if they are associated with the squares where
S, O, and D are played.
An even better play: play
EPISODE vertically, with the P immediately to the right of BO. Now five
different words are created: EPISODE (20 points), BOP(13 points), ROTS(4 points), LOO(3
points), and CROWD(15 points). In addition the player gets 50 bonus points for
playing all seven tiles, so the total score for this play is 105 points (check
me on the individual word scores and the total!).