| --- |
| title: Alien Riddle |
| emoji: π½ |
| sdk: gradio |
| sdk_version: 6.16.0 |
| app_file: app.py |
| pinned: true |
| hf_oauth: true |
| license: mit |
| hf_oauth_scopes: |
| - inference-api |
| tags: |
| - track:wood |
| - sponsor:modal |
| - achievement:offbrand |
| --- |
| |
| # Alien Riddle |
|
|
| Video demo: [youtube](https://huggingface.co/gdejan100) |
|
|
| Team HuggingFace: |
| - [gdejan100](https://huggingface.co/gdejan100) |
| - [huba179](https://huggingface.co/Huba179) |
|
|
| Social Media Post: [linkedin](https://www.linkedin.com/posts/chandraa17_alien-obfuscator-build-small-hackathon-share-7472299504717864960-Z4eh/?utm_source=share&utm_medium=member_desktop&rcm=ACoAAClgL5wBsZxQHEI7u4036mJ6LCHBciWvt-0) |
|
|
|
|
| An alien intelligence monitors all human communications. Resistance fighters encode messages as riddles drawn from ancient Earth texts β texts the alien cannot understand because they require *cultural context*, not decryption. The alien *sees* the riddle but can't *get* it. Humans can. |
|
|
| Built for the **HuggingFace Build Small Hackathon**. |
|
|
| ## How to Play |
|
|
| 1. **Encrypt** β Type a secret message and pick a theme (Greek Myth, Shakespeare, Grimm, Poetry, Chinese Classics). The AI will generate a poetic riddle that only humans can solve. |
| 2. **Solve** β Paste a friend's riddle card and guess the answer. Unlimited retries! |
| 3. **Challenge** β Race against the clock to solve as many auto-generated riddles as you can. |
|
|
| ## Architecture |
|
|
| - **Gradio** UI with dark sci-fi theming |
| - **Modular LLM backend** β Mock (offline) or Hugging Face Inference API |
| - **Corpus Manager** β Curated public-domain excerpts per theme |
| - **Riddle Generator** β Prompt builder + JSON schema validation + retry logic |
| - **Game Engine** β Timer, scoring, streaks, high-score persistence |
|
|
| ## Parameter Budget |
|
|
| - Primary LLM: up to 31B parameters (`google/gemma-4-31b-it`) |
| - Fallback: `google/gemma-4-26b-a4b-it` (MoE) |
| - Total: β€ 32B limit |
|
|
| ## Project Structure |
|
|
| ``` |
| alien-obfuscator/ |
| βββ app.py # Gradio UI (tabs, layout, callbacks) |
| βββ src/alien_obfuscator/ |
| β βββ config.py # Constants, model settings, paths |
| β βββ corpus_manager.py # Loads, selects, caches excerpts |
| β βββ riddle_generator.py # Prompt builder + LLM abstraction + validation |
| βββ corpus/ |
| β βββ greek_myth.txt # Curated excerpts |
| β βββ shakespeare.txt |
| β βββ grimm.txt |
| β βββ poetry.txt |
| β βββ chinese_classics.txt |
| βββ tests/ |
| β βββ test_corpus_manager.py |
| β βββ test_riddle_generator.py |
| βββ requirements.txt |
| βββ pyproject.toml |
| βββ README.md |
| ``` |
|
|
| ## Running Locally |
|
|
| ```bash |
| # Install dependencies |
| uv sync |
| |
| # Run the app |
| make start |
| |
| # Run tests |
| make test |
| |
| # Lint & type-check |
| make lint |
| make ty |
| ``` |
|
|
| ## License |
|
|
| This project uses public-domain texts and is provided as-is for the hackathon. |
|
|