Word Detective is a multilingual word puzzle game where players find all hidden words that can be formed using only seven letters displayed in a hexagonal interface.
Play it here.
The game automatically generates puzzles from text sources (books, articles, word lists) and serves them through an interactive web interface. Players are presented with 7 letters and must discover all valid words that can be spelled using only those letters.
Key Features:
- Multiple puzzle modes: Daily, Weekly, Random, and Custom (from uploaded text)
- Multi-language support: English, French, Italian, and Portuguese
- Word definitions lookup as players progress
- Progress persistence via browser cookies
- Hint system to help stuck players
The project consists of three main components:
┌─────────────────────────────────────────────────────────┐
│ WEB BROWSER (Frontend) │
│ HTML/CSS + JavaScript (Webpack bundle) │
│ Game UI, state management, cookie persistence │
└──────────────────────┬──────────────────────────────────┘
│ HTTP/REST API
┌──────────────────────▼──────────────────────────────────┐
│ NODE.JS SERVER (Express.js) │
│ REST API endpoints, template rendering │
│ Spawns C++ binaries for puzzle generation │
└──────────────────────┬──────────────────────────────────┘
│ Child Process
┌──────────────────────▼──────────────────────────────────┐
│ C++ BACKEND (CMake) │
│ Puzzle generation engine, data structures │
│ Unicode text processing, word validation │
└─────────────────────────────────────────────────────────┘
The core puzzle generation engine written in C++17:
- Data Structures: The Brick is a tree structure inspired by the Trie, where each path represents a set of characters and stores all words that can be spelled using exactly those characters. This makes puzzle generation a simple tree traversal: pick a path of 7 characters, and you instantly have all valid words for that puzzle.
- Text Processing: Unicode-aware text segmentation with ICU library support for multiple languages
- Applications:
word-detective: Generates puzzle JSON from pre-built word dataexport-brick: Converts raw text files into optimized binary.brkfiles
Express.js web server providing:
- REST API for puzzle generation and word definitions
- Game routes for different puzzle modes (daily, weekly, random, custom)
- Binary service bridge to execute C++ executables
- Internationalized UI templates
Vanilla JavaScript (ES6 modules) bundled with Webpack:
- Interactive hexagonal letter interface
- Game state management and word validation
- Cookie-based progress persistence
- Word definition display
source/
├── word-detective-backend/ # C++ core engine
│ ├── app/
│ │ ├── word-detective/ # Puzzle generation executable
│ │ └── export-brick/ # Text to .brk converter
│ ├── modules/
│ │ ├── datastr/ # Brick and Trie data structures
│ │ ├── utils/ # Text processing utilities
│ │ └── standard-extensions/
│ └── lab/test/ # Unit tests (Catch2)
│
├── server/ # Node.js web server
│ ├── modules/api/ # REST API routes
│ ├── games/ # Game mode templates
│ └── assets/
│ ├── messages/ # UI translations (en, fr, it, pt)
│ └── corpora/ # Word lists per language
│
├── word-detective-js/ # Frontend JavaScript
│ └── src/modules/ # Game controller, definitions, cookies
│
└── word-source-manager/ # Python utility for word sources
- C++: Boost (filesystem, system), ICU, nlohmann/json (shipped)
- Node.js: Express, node-fetch, express-fileupload
- Python: Jinja2 (for template rendering)
- Build: CMake 3.13+, Webpack
cd word-detective
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX="../install" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTS=ON \
..
make installCMake options:
BUILD_TESTS=ON/OFF- Build unit tests (default: OFF)BUILD_BENCHMARKS=ON/OFF- Build performance benchmarks (default: OFF)BUILD_STATIC=ON/OFF- Static linking (default: OFF)
cd build
ctest --output-on-failurecd source/server
npm install
npm startGenerate a puzzle from a text file:
./install/app/word-detective --input-file books/jekyll.txt --language enConvert a word list to optimized brick format:
./install/app/export-brick --input-file wordlist.txt --output-file words.brk --language en| Language | Code | Word Corpus |
|---|---|---|
| English | en | 5,000 words |
| French | fr | 5,000 words |
| Portuguese | pt | 5,000 words |
| Italian | it | 1,000 words |
See LICENSE file for details.