An advanced Scrabble implementation with optimized AI opponents, experimental game variants, and team-based mega board battles
Play Now โข Features โข Variants โข Tech Stack
This isn't just another Scrabble clone. Scrabble AI Arena is a high-performance testing ground for AI strategies with:
- ๐ฏ Optimized AI - DAWG/Trie-based move generation with cross-set pruning
- ๐๏ธ Mega Board - 45x45 grid with 8-player team battles
- ๐งช Experimental Variants - Modified rulesets to challenge AI decision-making
- ๐ค Multi-Difficulty AI - Compare strategies across Easy/Medium/Hard opponents
- ๐ AI vs AI Mode - Watch different difficulties compete for strategy analysis
- โก Real-Time Validation - SOWPODS dictionary with 267,751 words
- ๐จ Team Color Coding - Visual distinction for team members
- Complete Scrabble Implementation - Official rules with full tile bag
- Drag & Drop Interface - Smooth tile placement with
@dnd-kit - Instant Validation - Live preview shows validity and score in real-time
- Smart Word Detection - Validates all formed words including cross-words
- Move History - Track every play throughout the game
- Full-Screen Mode - Optimized for mega board viewing
Optimized with Professional Techniques:
- DAWG/Trie Data Structure - O(1) word validation and prefix checking
- Rack-Based Word Generation - Only generates playable words from current tiles
- Board-Aware Search - Finds words that extend existing board tiles
- Cross-Set Pruning - Pre-calculates valid letters at each position
- Alpha-Beta Pruning - Skips unpromising branches in HARD mode
Three Difficulty Levels:
| Difficulty | Strategy | Performance |
|---|---|---|
| Easy ๐ข | Random from all valid moves | ~50-200ms |
| Medium ๐ก | Random from top 50% moves | ~100-500ms |
| Hard ๐ด | Always highest-scoring move | ~200-1000ms |
AI Features:
- Uses full SOWPODS dictionary (267,751 words)
- Validates all words (including cross-words) before playing
- Team-aware resignation (only resigns if all teammates stuck)
- Generates moves in <1 second even on Mega Board
- Fully optimizes for bonus squares (DW/TW/DL/TL)
Classic Scrabble layout - the baseline for comparison
2.5x more bonus squares for aggressive scoring strategies
- Tests AI's ability to maximize multipliers
- Favors positional play over vocabulary
Procedurally generated bonus placement every game
- Eliminates memorized optimal positions
- Tests AI adaptability to unknown layouts
Risk/reward gameplay with dangerous squares
- Hazard squares deduct 10 points
- Forces strategic risk assessment
The Ultimate Scrabble Challenge
A massive 45x45 grid designed for 8-player team battles (4v4). Features:
- Extended Premium Squares - Strategic DL/TL/DW/TW placement across the expanded board
- Team Mode - Red vs Blue teams with color-coded tiles for easy tracking
- Longer Games - More space = more complex strategies and higher scores
- Performance Optimized - Handles 2,025 squares smoothly
- ๐ค Human vs AI - Classic gameplay with AI opponent
- ๐ค AI vs AI - Watch and learn from AI strategies
- Set different difficulties for each AI
- Great for benchmarking and analysis
- ๐ฅ Teams (Mega Only) - 4v4 team battles on the mega board
- Red Team vs Blue Team
- Color-coded tiles by team
- Team-aware AI resignation logic
- Interleaved turn order
node --version # v18.0.0 or higher
npm --version # v9.0.0 or higher# Clone
git clone https://github.com/xerk-dot/scrabble_with_gemini_3.0.git
cd scrabble_with_gemini_3.0
# Install
npm install
# Run
npm run devOpen โ http://localhost:3000 ๐
npm run build
npm start- Choose board variant (Standard, Bonus Blitz, Random, Hazards, or Mega)
- Select game mode (Human vs AI, AI vs AI, or Teams for Mega)
- Pick AI difficulty (or two for AI vs AI)
- Click "New Game"
- Drag tiles from rack to board
- Live preview shows validity โ/โ and score
- Submit to play or Recall to undo
| Button | Action |
|---|---|
| Submit | Play your word |
| Recall | Take back tiles |
| Shuffle | Reorganize rack |
| Pass | Skip turn |
| Resign | Give up (when stuck) |
- Highest score when all players resign
- Team mode: Highest team score wins
- AI auto-resigns when no valid moves exist (team-aware)
- Framework โ Next.js 15 with App Router
- Language โ TypeScript for type safety
- UI โ React 18 with CSS Modules
- Drag & Drop โ @dnd-kit/core
- Validation โ Server Actions with SOWPODS
- State โ React Context API
- AI Optimization โ DAWG/Trie, Cross-Sets, Alpha-Beta Pruning
-
DAWG/Trie Data Structure (
src/lib/dawg.ts)- O(1) word validation
- Instant prefix checking
- Cached globally for performance
-
Rack-Based Word Generation (
src/lib/word-generator.ts)- Generates only words from available tiles
- Handles blank tiles (tries all 26 letters)
- Board-aware extensions (e.g., CAT โ CATS)
-
Cross-Set Pruning (
src/lib/cross-sets.ts)- Pre-calculates valid letters at each position
- Filters invalid placements before validation
- Separate sets for horizontal/vertical plays
-
Alpha-Beta Pruning (HARD mode only)
- Skips words that can't beat current best score
- Estimates maximum possible score
- 2-3x speedup for HARD difficulty
Expected Performance:
- Standard board: <100ms per move
- Mega Board: <1 second per move (HARD mode)
- 100% accuracy maintained
Speedup vs Brute Force:
- 10-100x faster on average
- Scales well to Mega Board (45x45)
src/
โโโ app/
โ โโโ actions.ts # ๐ Word validation (Server Actions)
โ โโโ ai-actions.ts # ๐ค Optimized AI move generation
โ โโโ page.tsx # ๐ Main page
โโโ components/
โ โโโ Board.tsx # ๐ฒ Game board with team colors
โ โโโ Game.tsx # ๐ฎ Game controller
โ โโโ Rack.tsx # ๐ซ Tile rack with controls
โ โโโ Square.tsx # โฌ Board squares
โ โโโ Tile.tsx # ๐ Individual tiles (team colored)
โโโ context/
โ โโโ GameContext.tsx # ๐ State management & team logic
โโโ lib/
โโโ constants.ts # ๐ Board layouts (including Mega)
โโโ cross-sets.ts # ๐ฏ Cross-set calculation
โโโ dawg.ts # ๐ณ DAWG/Trie data structure
โโโ gameUtils.ts # ๐ ๏ธ Board init, tile bag
โโโ scoring.ts # ๐ Score calculation
โโโ teamColors.ts # ๐จ Team color utilities
โโโ types.ts # ๐ TypeScript types
โโโ validation.ts # โ
Move validation
โโโ word-generator.ts # ๐ Rack-based word generation
Built with Google Gemini assistance.
Contributions welcome! Feel free to:
- ๐ Report bugs
- ๐ก Suggest new variants
- ๐ Submit PRs
- ๐ Improve docs
MIT License - see LICENSE
- Inspiration - Classic Scrabble by Hasbro
- AI Assistant - Google Gemini 3.0
Optimized AI โข Mega Battles โข Team Play ๐ฒโจ

