# farairudokapopo-code/beat-the-sphinx architecture

> Architecture diagram of the GitHub repository farairudokapopo-code/beat-the-sphinx, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/farairudokapopo-code/beat-the-sphinx
- Repository: https://github.com/farairudokapopo-code/beat-the-sphinx

## Overview

Beat the Sphinx is a browser-based daily riddle game. The player enters the game, answers three date-seeded riddles across rising difficulty, and receives a survival result, streak/stat updates, points, and a shareable score. Points also support a god-helper shop and Sphinx skin customization. The graph preserves those documented branches; the sampled excerpts show the main controller invoking art, gods, skins, and sound, but do not expose every runtime transition or the HTML wiring.

Main entry points: [`script.js`](https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/script.js) (Game controller), [`art.js`](https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/art.js) (Pixel-art engine), [`skins.js`](https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/skins.js) (Sphinx display), [`gods.js`](https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/gods.js) (God portraits)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gameplay["Daily gameplay"]
  node_game["Game controller<br/>[script.js]"]
  node_daily["Daily selection<br/>[script.js]"]
  node_riddlebank["Riddle tiers<br/>[riddles.js]"]
  node_answer["Answer and powers<br/>[script.js]"]
  node_results["Results and sharing<br/>[script.js]"]
end

subgraph group_progression["Progression and profile"]
  node_profile[("Stats and profile<br/>[script.js]")]
  node_points["Points rewards<br/>[script.js]"]
  node_godshop["God shop<br/>[script.js]"]
  node_gods["God catalog<br/>[gods.js]"]
  node_skinshop["Skin customization<br/>[script.js]"]
  node_skins["Skin catalog<br/>[skins.js]"]
end

subgraph group_presentation["Pixel art and audio"]
  node_sphinx["Sphinx display<br/>[skins.js]"]
  node_godportrait["God portraits<br/>[gods.js]"]
  node_artengine["Pixel-art engine<br/>[art.js]"]
  node_sprites["Grid sprites<br/>[sprites.js]"]
  node_sound["Sound effects<br/>[sound.js]"]
end

node_player(("Player"))
node_browserstore[("Browser storage")]
node_clipboard["Clipboard"]

node_player -->|"plays"| node_game
node_game -->|"selects daily"| node_daily
node_daily -->|"draws riddles"| node_riddlebank
node_player -->|"submits answers"| node_answer
node_answer -->|"records outcome"| node_results
node_results -->|"awards points"| node_points
node_results -->|"updates stats"| node_profile
node_results -->|"copies score"| node_clipboard
node_player -->|"shops"| node_godshop
node_godshop -->|"lists gods"| node_gods
node_answer -->|"applies helper"| node_gods
node_player -->|"customizes"| node_skinshop
node_skinshop -->|"lists skins"| node_skins
node_skinshop -->|"saves look"| node_profile
node_game -->|"loads and saves"| node_profile
node_game -->|"updates mood"| node_sphinx
node_sphinx -->|"paints canvas"| node_artengine
node_godshop -->|"draws portraits"| node_godportrait
node_godportrait -->|"paints canvas"| node_artengine
node_game -->|"plays effects"| node_sound
node_game -->|"checks availability"| node_sprites
node_artengine -->|"renders characters"| node_player
node_sound -->|"stores mute"| node_browserstore

click node_game "https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/script.js"
click node_daily "https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/script.js"
click node_riddlebank "https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/riddles.js"
click node_answer "https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/script.js"
click node_results "https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/script.js"
click node_profile "https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/script.js"
click node_points "https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/script.js"
click node_godshop "https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/script.js"
click node_gods "https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/gods.js"
click node_skinshop "https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/script.js"
click node_skins "https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/skins.js"
click node_sphinx "https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/skins.js"
click node_godportrait "https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/gods.js"
click node_artengine "https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/art.js"
click node_sprites "https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/sprites.js"
click node_sound "https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/sound.js"

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_daily,node_riddlebank,node_answer,node_results toneBlue
class node_profile,node_points,node_godshop,node_gods,node_skinshop,node_skins,node_browserstore toneAmber
class node_sphinx,node_godportrait,node_artengine,node_sprites,node_sound toneMint
class node_player,node_clipboard toneIndigo
```

## Components

### Daily gameplay

- [Game controller](https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/script.js): `script.js`
- [Daily selection](https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/script.js): `script.js`
- [Riddle tiers](https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/riddles.js): `riddles.js`
- [Answer and powers](https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/script.js): `script.js`
- [Results and sharing](https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/script.js): `script.js`

### Progression and profile

- [Stats and profile](https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/script.js): `script.js`
- [Points rewards](https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/script.js): `script.js`
- [God shop](https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/script.js): `script.js`
- [God catalog](https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/gods.js): `gods.js`
- [Skin customization](https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/script.js): `script.js`
- [Skin catalog](https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/skins.js): `skins.js`

### Pixel art and audio

- [Sphinx display](https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/skins.js): `skins.js`
- [God portraits](https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/gods.js): `gods.js`
- [Pixel-art engine](https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/art.js): `art.js`
- [Grid sprites](https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/sprites.js): `sprites.js`
- [Sound effects](https://github.com/farairudokapopo-code/beat-the-sphinx/blob/main/sound.js): `sound.js`

### Other components

- **Player**
- **Browser storage**
- **Clipboard**

## Connections

- Player → Game controller: plays (evidence: `README.md`)
- Game controller → Daily selection: selects daily (evidence: `README.md`)
- Daily selection → Riddle tiers: draws riddles (evidence: `README.md`)
- Player → Answer and powers: submits answers (evidence: `README.md`)
- Answer and powers → Results and sharing: records outcome (evidence: `README.md`)
- Results and sharing → Points rewards: awards points (evidence: `README.md`)
- Results and sharing → Stats and profile: updates stats (evidence: `README.md`)
- Results and sharing → Clipboard: copies score (evidence: `script.js`)
- Player → God shop: shops (evidence: `README.md`)
- God shop → God catalog: lists gods (evidence: `script.js`)
- Answer and powers → God catalog: applies helper (evidence: `script.js`)
- Player → Skin customization: customizes (evidence: `README.md`)
- Skin customization → Skin catalog: lists skins (evidence: `script.js`)
- Skin customization → Stats and profile: saves look (evidence: `script.js`)
- Game controller → Stats and profile: loads and saves (evidence: `script.js`)
- Game controller → Sphinx display: updates mood (evidence: `script.js`)
- Sphinx display → Pixel-art engine: paints canvas (evidence: `skins.js`)
- God shop → God portraits: draws portraits (evidence: `script.js`)
- God portraits → Pixel-art engine: paints canvas (evidence: `gods.js`)
- Game controller → Sound effects: plays effects (evidence: `script.js`)
- Game controller → Grid sprites: checks availability (evidence: `script.js`)
- Pixel-art engine → Player: renders characters (evidence: `README.md`)
- Sound effects → Browser storage: stores mute (evidence: `sound.js`)
