Program 5 - Two-dimensional arrays: Scrabble

This is a draft and subject to minor changes and improvements through November 22nd. The changes will be small to improve clarity etc. not to change the main aspects of the assignment. Last updated: 10am 11-18-04

For this assignment you will implement the game Scrabble (a registered trademark). A large portion of the game has been written and you only need to complete it.

Scrabble is a word game played on a 15x15 board. Words are played from a collection of 100 tiles with letters on them. Players take turns adding tiles to the board to make new words. If you are not familiar with the game you can find a complete explanation and rules at http://www.hasbro.com/scrabble/pl/page.rules/dn/home.cfm.

The game you implement will follow the standard rules with the following exceptions:

  1. There will be only two players.
  2. The first word must start at the center square (7,7).
  3. Both players will be able to see both racks of letters.
  4. The computer will not check that the sequences of letters actually form words. It will only check that they are played in legal positions.

A user can pass by entering the word "PASS". The user can exchange all tiles in his or her rack by entering the word "DUMP".

If both players pass consequtively the game ends.

The program turned out to be much more complicated than originally expected so you are given large part of the code. There are two parts to this assignment. The first part, if done perfectly will give you a score of 80/100 for this assignment. For the remaining 20 points you will also need to complete part two of the assignment.

Part One

For this part of the assignment you are to create a working program that exactly matches the behavior of the sample solution, using the three completed classes, Board, Tiles, and Rack. Here is the link to the javadoc documentation for the three classes. You can copy the compiled versions of the completed classes from /afs/cats/courses/cmps012a-cm/prog5.

Part Two

After completing part 1, you should try and complete part 2. For this you will need to provide the missing methods from the class Board. The incomplete source Board.java can be found in /afs/cats/courses/cmps012a-cm/prog5. The methods that you need to complete are:
  1. toString()
  2. isLegal()
  3. Board() - the constructor
  4. isFilled()
  5. play() - it is partially completed

A Sample Run

Coming soon. For now you can just run the sample solution (Scrabble.class) in the usual place, /afs/cats/courses/cmps012a-cm/prog5. To run the sample solution, copy all of the class files to some directory of yours and the type "java Scrabble 123". You can change 123 to any number. This is used to seed the random number generator that mixes up the tiles.`
This page maintained by Charlie McDowell. Email regarding this site.