Don't like this style? Click here to change it! blue.css

Scrabble Helper

For this project you're going to design code to give the highest scoring plays given a particular rack, board, and dictionary.

If you don't know how to play scrabble, I suggest you go to facebook and play some there. I would even be OK with a Thanksgiving week scrabble tournament on campus. Anyhow, you are given a rack of 7 letter tiles (and sometimes a wild-card tile which can be any letter) and you play words onto the board so that every word read across or down is a legal word in the dictionary. Your score is the sum of the letter-values in all new words you create. There are bonus tiles which can double or triple the letters or words intersecting that tile. There are plenty of online rule sets and guides.

The opening move must use the center tile which counts as a double word tile.

Your goal: produce a list of the top 20 highest scoring plays for that player (perhaps with x,y coordinates and a direction (right or down)). Think deep about (or research obscure…) data structures that can help you do this in close to real time. You will receive the rack and board in a format I chose for this project. I will give you a dictionary to use. Also I will provide you a Python script and some instructions for creating this board format from a real, live, game of Scrabble from facebook (YMMV).

The File Format

Your program should read the following file format:

The first row will contain the tiles from your rack. (* for wild-card.)

The board is 15x15 and it is on the next 15 rows which contain 15 characters each.

A - is an empty space.

A capital letter is a tile which has been played.

A 2 is a double letter tile.

A 3 is a triple letter tile.

A 4 is a double word tile.

A 9 is a triple word tile.

Here is a sample:

The Dictionary

Here is a dictionary of all scrabble legal words (right click and save-as).

The tile values

Here is a file with each letter followed by its value.

Making your own board

Here is a python2 program which consumes the facebook scrabble app HTML and returns the board in the format I specified. These things have a way of changing every now and again so who knows if it will work in a year.

You will need to first install beautifulsoup4 like this:

        sudo pip install beautifulsoup4

You then run the program with the command:


This program expects you to have a file named scrabble.html and your output will be put into a file named board.txt.

To get the correct html you need to right click on the board of the running app (in chrome) and select Inspect Element. Scroll up until you see <html class=" js draganddrop audio localstorage webworkers">. Then right click and "Edit as HTML". Control-A, Control-C, head to a file named scrabble.html and Control-V. Not perfect or pretty, but it'll do.

Suggestions in decreasing order of complexity

Try this data structure out:

Or this one:

Burst Tries: