Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Find total points scored by a word using Scrabble tiles
ResourceFunction["ScrabbleScore"]["word"] computes the points scored for playing "word" with Scrabble tiles. |
| "Language" | "English" | the letter distribution used will come from this language's Scrabble edition |
| "AllowBlanks" | False | whether to use up to two blank tiles to construct the string |
Find the number of points scored by the word "scrabble":
| In[1]:= |
| Out[1]= |
Blanks are denoted by '?' characters. They contribute zero points to the total:
| In[2]:= |
| Out[2]= |
In principle, this input could be the valid Scrabble word "zzz", requiring two blank Zs. The score is therefore 10 + 0 + 0 = 10:
| In[3]:= |
| Out[3]= |
The word "zigzagging" contains two Zs and four Gs but the English tile bag contains only one Z and three Gs. Here, we allow a blank G and Z that each contribute zero points to the total:
| In[4]:= |
| Out[4]= |
This is equivalent to the following (where "AllowBlanks" is False by default):
| In[5]:= |
| Out[5]= |
Setting "AllowBlanks" to True is allowed even when additional blanks are neither allowed nor required:
| In[6]:= |
| Out[6]= |
Choosing a different language uses a different character set and tile distribution:
| In[7]:= |
| Out[7]= |
| In[8]:= |
| Out[8]= |
| In[9]:= |
| Out[9]= |
| In[10]:= |
| Out[10]= |
| In[11]:= |
| Out[11]= |
Some Scrabble editions contain 'digraphs', whereby two characters are treated as a single tile. For example, the Welsh "CH":
| In[12]:= |
| Out[12]= |
| In[13]:= |
| Out[13]= |
| In[14]:= |
| Out[14]= |
This means that we can have inputs with < 15 tiles, but > 15 characters:
| In[15]:= |
| Out[15]= |
| In[16]:= |
| Out[16]= |
| In[17]:= |
| Out[17]= |
The word must be 15 tiles or less in order to fit on a standard Scrabble board:
| In[18]:= |
Special characters other than "?" are not allowed:
| In[19]:= |
The input string cannot contain more than two blank tiles:
| In[20]:= |
Some input strings cannot be constructed without blank tiles:
| In[21]:= |
Some input strings cannot be constructed, even when blanks are permitted. Here "KNICKKNACK" contains four Ks but the English tile bag contains only one. There are not enough 'blanks' to construct this word:
| In[22]:= |
The same error is returned if "?" tiles are explicitly declared and they are still insufficient to construct the input string:
| In[23]:= |
Allowing blanks is superfluous if two are already used via "?" tiles:
| In[24]:= |
The input string must only contain tiles that are present in the tile bag of the selected language:
| In[25]:= |
The "Language" option must be set to a language for which a Scrabble edition exists:
| In[26]:= |
The "AllowBlanks" option must be either True or False:
| In[27]:= |
Given that Scrabble word lists are protected by copyright, there is no way to verify that an input is a valid Scrabble word. This means that the 'score' is still found for a nonsense, but still valid, input:
| In[28]:= |
| Out[28]= |
Highest scoring English Scrabble word:
| In[29]:= |
| Out[29]= |
Wolfram Language 13.0 (December 2021) or above
This work is licensed under a Creative Commons Attribution 4.0 International License