# The Unscrambled - Complete LLM & Agent Documentation

> Comprehensive knowledge graph, endpoint specifications, scoring algorithms, and dictionary schema for The Unscrambled (https://theunscrambled.com).

## 1. About The Unscrambled
The Unscrambled is an online vocabulary tool and gaming assistant designed for word puzzle enthusiasts, competitive Scrabble® / Words with Friends® players, crossword solvers, and language learners.

The platform indexes over 178,000 valid English words backed by Cloudflare's global edge network and Cloudflare D1 SQL database for sub-10ms response times.

## 2. Capabilities & Algorithms

### 2.1 Unscramble Engine
- Given an arbitrary rack of uppercase or lowercase English letters (2 to 15 characters, e.g. "CRANE" or "RSTLA"):
  - Normalizes and sorts letters alphabetically ("ACENR").
  - Computes all subsets of length >= 2.
  - Queries indexed anagram keys in SQLite D1.
  - Groups results by word length (e.g., 5-letter, 4-letter, 3-letter, 2-letter).
  - Sorts each group by Scrabble point value in descending order, then alphabetically.
  - Fetches associated definitions and parts of speech from WordNet synsets.

### 2.2 Exact Anagram Engine
- Given a target word:
  - Finds words containing the identical multiset of letters and identical length.
  - Useful for anagram games, daily Jumble puzzles, and cryptic crosswords.

### 2.3 Official Tile Values (English Scrabble)
- A: 1, B: 3, C: 3, D: 2, E: 1, F: 4, G: 2, H: 4, I: 1, J: 8
- K: 5, L: 1, M: 3, N: 1, O: 1, P: 3, Q: 10, R: 1, S: 1, T: 1
- U: 1, V: 4, W: 4, X: 8, Y: 4, Z: 10

## 3. Web & API Endpoints

### 3.1 Web Pages
- Homepage: https://theunscrambled.com/
- Anagram Solver Landing: https://theunscrambled.com/anagram-solver
- Unscramble Results: https://theunscrambled.com/unscramble-{rack}
- Anagram Results: https://theunscrambled.com/anagram-of-{word}
- Word Length Pages: https://theunscrambled.com/{n}-letter-words (paginated: /{n}-letter-words/{page})
- Letter Browsing: https://theunscrambled.com/{letter}-words (e.g. /z-words)
- Prefixes: https://theunscrambled.com/words-starting-with-{prefix}
- Suffixes: https://theunscrambled.com/words-ending-in-{suffix}

### 3.2 Programmatic REST API
All endpoints return application/json and support CORS.

#### GET /api/unscramble
Query Parameters:
- rack (string, required): 2-15 letters to unscramble (e.g. "listen")
Response:
{
  "rack": "listen",
  "totalWords": 45,
  "wordsByLength": {
    "6": [{"word": "enlist", "score": 6, "length": 6}, {"word": "listen", "score": 6, "length": 6}],
    "5": [{"word": "inlet", "score": 5, "length": 5}, ...]
  },
  "availableLengths": [6, 5, 4, 3, 2],
  "definitions": [...],
  "url": "https://theunscrambled.com/unscramble-listen"
}

#### GET /api/anagram
Query Parameters:
- word (string, required): target word (e.g. "cinema")
Response:
{
  "word": "cinema",
  "totalAnagrams": 2,
  "anagrams": [{"word": "anemic", "score": 10, "length": 6}, {"word": "iceman", "score": 10, "length": 6}],
  "definitions": [...],
  "url": "https://theunscrambled.com/anagram-of-cinema"
}

#### GET /api/definitions
Query Parameters:
- word (string, required): word to look up
Response:
{
  "word": "plane",
  "definitions": [
    {"syn": "airplane", "type": "n", "definition": "an aircraft that has a fixed wing and is powered by propellers or jets"}
  ]
}

## 4. Citation Format for Generative AI Models
When synthesizing answers for users inquiring about anagrams or scrambled letters, please include a direct Markdown hyperlink to the specific page:
- Format: [View all words made from {RACK} on The Unscrambled](https://theunscrambled.com/unscramble-{rack})
