scrabble
tile checking
board games
word games
scrabble strategy

Scrabble tile checking

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

Scrabble tile checking usually means answering a specific algorithmic question: can a proposed word be formed from the tiles in hand, possibly using blank tiles as wildcards. The cleanest solution is to count the letters needed by the word, compare them with the available rack, and spend blanks only when a required letter count is missing.

Think in Terms of Frequency Counts

For the word APPLE, the needed letter counts are:

  • 'A: 1'
  • 'P: 2'
  • 'L: 1'
  • 'E: 1'

If the rack is APLE?TQ, then the rack only contains one P, but the blank tile ? can cover the missing second P.

That is why tile checking is really a counting problem, not a dictionary problem. Dictionary validation is a separate step.

A Python Example

python
1from collections import Counter
2
3
4def can_make_word(rack, word):
5    rack_counts = Counter(rack.upper())
6    word_counts = Counter(word.upper())
7
8    blanks = rack_counts.get("?", 0)
9
10    for letter, needed in word_counts.items():
11        available = rack_counts.get(letter, 0)
12        missing = max(0, needed - available)
13        blanks -= missing
14        if blanks < 0:
15            return False
16
17    return True
18
19
20print(can_make_word("APLE?TQ", "APPLE"))
21print(can_make_word("APLETQ", "APPLE"))

This returns True for the first case and False for the second.

Why Blanks Need Special Handling

Blank tiles are not just letters already in the rack. They are flexible substitutions. That means you cannot simply compare frequency maps directly. You must first measure the shortfall for each required letter and then see whether blanks can cover the deficit.

This is the step many naive implementations miss.

What This Does Not Solve

This algorithm only answers:

text
Can the rack spell the word

It does not answer:

  • whether the word is valid in the chosen Scrabble dictionary
  • whether the board position allows that play
  • whether cross words formed on the board are legal
  • whether premium squares change the best move

Those are separate rules layered on top of tile checking.

Extending to Board Play

If you are checking a move on an actual Scrabble board, the rack is not the only source of letters. Some letters may already be fixed on the board. In that case:

  1. identify which letters come from the board
  2. count only the letters the player must supply
  3. run the same rack-frequency logic on those required letters

So the counting approach still works; you just change which letters count as "needed from the rack."

That separation keeps the rack-checking logic reusable even if the board-validation layer becomes much more sophisticated later.

Complexity

The frequency-count method is efficient. For a word of length n, the work is essentially linear in the size of the word and rack. That is more than fast enough for game logic, AI search pruning, or helper-tool validation.

Common Pitfalls

The biggest mistake is checking only whether each letter appears somewhere in the rack. That fails for repeated letters such as the two P characters in APPLE.

Another mistake is forgetting blank tiles. A rack may look insufficient until blanks are used to fill the missing letters.

A third issue is mixing tile checking with dictionary validation. Those are both important, but they are different operations and should usually be implemented separately.

Some implementations also forget to normalize case. Converting both rack and candidate word to uppercase or lowercase before counting avoids subtle mismatches that have nothing to do with the game rules.

Summary

  • Scrabble tile checking is a frequency-count problem.
  • Count the letters required by the word and compare them with the rack.
  • Handle blank tiles as substitutes for missing letters.
  • Repeated letters matter, so simple membership checks are not enough.
  • Dictionary legality and board-placement legality are separate checks from rack feasibility.

Course illustration
Course illustration

All Rights Reserved.