# ai-platon/krokodil architecture

> Architecture diagram of the GitHub repository ai-platon/krokodil, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ai-platon/krokodil
- Repository: https://github.com/ai-platon/krokodil

## Overview

Krokodil is a browser-based AI charades game, also documented as running inside an Android WebView. The main workflow is to choose a topic and difficulty, generate words through Groq, then use them for solo play or a timed team game. The README also documents generation history, per-topic leaderboards, and local API-key storage. The file tree contains only index.html, while the README describes the app as krokodil.html; with no source excerpts, implementation details are mapped only to the available HTML path and relationships are limited to those documented.

Main entry points: [`index.html`](https://github.com/ai-platon/krokodil/blob/main/index.html) (Word generation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_play["Game experience"]
  node_game["Game interface<br/>[index.html]"]
  node_solo["Solo word list<br/>[index.html]"]
  node_team["Team game<br/>[index.html]"]
  node_turns["Turns and timer<br/>[index.html]"]
  node_results["Team results<br/>[index.html]"]
end

subgraph group_generation["Word generation"]
  node_topic["Topic and difficulty<br/>[index.html]"]
  node_wordgen["Word generation<br/>[index.html]"]
end

subgraph group_records["Local records"]
  node_history["Generation history<br/>[index.html]"]
  node_leaderboard["Topic leaderboard<br/>[index.html]"]
  node_key["API key memory<br/>[index.html]"]
end

node_player(("Player"))
node_groq{{"Groq API"}}
node_storage[("Browser localStorage")]

node_player -->|"uses"| node_game
node_game -->|"sets options"| node_topic
node_game -->|"requests words"| node_wordgen
node_topic -->|"configures"| node_wordgen
node_wordgen -->|"requests generation"| node_groq
node_groq -->|"returns words"| node_wordgen
node_wordgen -->|"provides list"| node_solo
node_player -->|"sets up players"| node_team
node_team -->|"chooses settings"| node_topic
node_team -->|"runs turns"| node_turns
node_turns -->|"completes rounds"| node_results
node_wordgen -->|"saves word sets"| node_history
node_history -->|"stores locally"| node_storage
node_results -->|"records rankings"| node_leaderboard
node_leaderboard -->|"stores locally"| node_storage
node_player -->|"enters key"| node_key
node_key -->|"saves key"| node_storage

click node_game "https://github.com/ai-platon/krokodil/blob/main/index.html"
click node_topic "https://github.com/ai-platon/krokodil/blob/main/index.html"
click node_wordgen "https://github.com/ai-platon/krokodil/blob/main/index.html"
click node_solo "https://github.com/ai-platon/krokodil/blob/main/index.html"
click node_team "https://github.com/ai-platon/krokodil/blob/main/index.html"
click node_turns "https://github.com/ai-platon/krokodil/blob/main/index.html"
click node_results "https://github.com/ai-platon/krokodil/blob/main/index.html"
click node_history "https://github.com/ai-platon/krokodil/blob/main/index.html"
click node_leaderboard "https://github.com/ai-platon/krokodil/blob/main/index.html"
click node_key "https://github.com/ai-platon/krokodil/blob/main/index.html"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_game,node_solo,node_team,node_turns,node_results toneBlue
class node_topic,node_wordgen,node_storage toneAmber
class node_history,node_leaderboard,node_key,node_groq toneMint
class node_player toneIndigo
```

## Components

### Game experience

- [Game interface](https://github.com/ai-platon/krokodil/blob/main/index.html): `index.html`
- [Solo word list](https://github.com/ai-platon/krokodil/blob/main/index.html): `index.html`
- [Team game](https://github.com/ai-platon/krokodil/blob/main/index.html): `index.html`
- [Turns and timer](https://github.com/ai-platon/krokodil/blob/main/index.html): `index.html`
- [Team results](https://github.com/ai-platon/krokodil/blob/main/index.html): `index.html`

### Word generation

- [Topic and difficulty](https://github.com/ai-platon/krokodil/blob/main/index.html): `index.html`
- [Word generation](https://github.com/ai-platon/krokodil/blob/main/index.html): `index.html`

### Local records

- [Generation history](https://github.com/ai-platon/krokodil/blob/main/index.html): `index.html`
- [Topic leaderboard](https://github.com/ai-platon/krokodil/blob/main/index.html): `index.html`
- [API key memory](https://github.com/ai-platon/krokodil/blob/main/index.html): `index.html`

### Other components

- **Player**
- **Groq API**
- **Browser localStorage**

## Connections

- Player → Game interface: uses (evidence: `README.md`)
- Game interface → Topic and difficulty: sets options (evidence: `README.md`)
- Game interface → Word generation: requests words (evidence: `README.md`)
- Topic and difficulty → Word generation: configures (evidence: `README.md`)
- Word generation → Groq API: requests generation (evidence: `README.md`)
- Groq API → Word generation: returns words (evidence: `README.md`)
- Word generation → Solo word list: provides list (evidence: `README.md`)
- Player → Team game: sets up players (evidence: `README.md`)
- Team game → Topic and difficulty: chooses settings (evidence: `README.md`)
- Team game → Turns and timer: runs turns (evidence: `README.md`)
- Turns and timer → Team results: completes rounds (evidence: `README.md`)
- Word generation → Generation history: saves word sets (evidence: `README.md`)
- Generation history → Browser localStorage: stores locally (evidence: `README.md`)
- Team results → Topic leaderboard: records rankings (evidence: `README.md`)
- Topic leaderboard → Browser localStorage: stores locally (evidence: `README.md`)
- Player → API key memory: enters key (evidence: `README.md`)
- API key memory → Browser localStorage: saves key (evidence: `README.md`)
