# ssv32/game-js-find250diff architecture

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

- Interactive diagram: https://gitdiagram.com/ssv32/game-js-find250diff
- Repository: https://github.com/ssv32/game-js-find250diff

## Overview

This is a browser-based spot-the-difference game: the player selects a level, finds five marked differences, and advances or loses after repeated misses. Menus also provide pause, hints, settings, language selection, and ad-based hint replenishment. The README describes Yandex Games support and a larger published level set; this branch contains five levels and the sampled code shows optional SDK calls. Some menu wiring is excerpted only partially, so unsupported connections are omitted.

Main entry points: [`src/main.js`](https://github.com/ssv32/game-js-find250diff/blob/main/src/main.js) (Level gameplay), [`src/menu.js`](https://github.com/ssv32/game-js-find250diff/blob/main/src/menu.js) (Menu controls), [`src/sound.js`](https://github.com/ssv32/game-js-find250diff/blob/main/src/sound.js) (Sound playback), [`src/lang.js`](https://github.com/ssv32/game-js-find250diff/blob/main/src/lang.js) (Language content)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_play["Gameplay"]
  node_gameplay["Level gameplay<br/>[main.js]"]
  node_canvas["Canvas rendering<br/>[main.js]"]
  node_progress["Level outcomes<br/>[main.js]"]
end

subgraph group_menus["Menus and help"]
  node_menus["Menu controls<br/>[menu.js]"]
  node_hints["Hint and rewards<br/>[menu.js]"]
  node_language["Language content<br/>[lang.js]"]
end

subgraph group_content["Game content"]
  node_leveldata["Level definitions<br/>[levals.js]"]
  node_images["Level artwork"]
  node_audio["Sound playback<br/>[sound.js]"]
  node_soundfiles["Sound effects"]
end

subgraph group_services["Browser services"]
  node_browserstate[("Saved progress")]
  node_yandex["Yandex Games SDK"]
end

node_player(("Player"))

node_player -->|"chooses actions"| node_menus
node_player -->|"finds differences"| node_gameplay
node_gameplay -->|"selects level"| node_leveldata
node_gameplay -->|"loads artwork"| node_images
node_gameplay -->|"renders and checks"| node_canvas
node_gameplay -->|"updates outcomes"| node_progress
node_gameplay -->|"plays effects"| node_audio
node_menus -->|"selects levels"| node_gameplay
node_menus -->|"plays clicks"| node_audio
node_menus -->|"uses translations"| node_language
node_menus -->|"opens hint flow"| node_hints
node_hints -->|"saves hint count"| node_browserstate
node_gameplay -->|"reads saved values"| node_browserstate
node_audio -->|"loads effects"| node_soundfiles
node_gameplay -.->|"starts and stops play"| node_yandex
node_hints -.->|"requests rewarded ads"| node_yandex
node_menus -.->|"requests fullscreen ads"| node_yandex

click node_gameplay "https://github.com/ssv32/game-js-find250diff/blob/main/src/main.js"
click node_canvas "https://github.com/ssv32/game-js-find250diff/blob/main/src/main.js"
click node_progress "https://github.com/ssv32/game-js-find250diff/blob/main/src/main.js"
click node_menus "https://github.com/ssv32/game-js-find250diff/blob/main/src/menu.js"
click node_hints "https://github.com/ssv32/game-js-find250diff/blob/main/src/menu.js"
click node_language "https://github.com/ssv32/game-js-find250diff/blob/main/src/lang.js"
click node_leveldata "https://github.com/ssv32/game-js-find250diff/blob/main/src/levals.js"
click node_images "https://github.com/ssv32/game-js-find250diff/tree/main/assets/images"
click node_audio "https://github.com/ssv32/game-js-find250diff/blob/main/src/sound.js"
click node_soundfiles "https://github.com/ssv32/game-js-find250diff/tree/main/assets/sounds"

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_gameplay,node_canvas,node_progress toneBlue
class node_menus,node_hints,node_language toneAmber
class node_leveldata,node_images,node_audio,node_soundfiles toneMint
class node_browserstate,node_yandex toneRose
class node_player toneIndigo
```

## Components

### Gameplay

- [Level gameplay](https://github.com/ssv32/game-js-find250diff/blob/main/src/main.js): `src/main.js`
- [Canvas rendering](https://github.com/ssv32/game-js-find250diff/blob/main/src/main.js): `src/main.js`
- [Level outcomes](https://github.com/ssv32/game-js-find250diff/blob/main/src/main.js): `src/main.js`

### Menus and help

- [Menu controls](https://github.com/ssv32/game-js-find250diff/blob/main/src/menu.js): `src/menu.js`
- [Hint and rewards](https://github.com/ssv32/game-js-find250diff/blob/main/src/menu.js): `src/menu.js`
- [Language content](https://github.com/ssv32/game-js-find250diff/blob/main/src/lang.js): `src/lang.js`

### Game content

- [Level definitions](https://github.com/ssv32/game-js-find250diff/blob/main/src/levals.js): `src/levals.js`
- [Level artwork](https://github.com/ssv32/game-js-find250diff/tree/main/assets/images): `assets/images`
- [Sound playback](https://github.com/ssv32/game-js-find250diff/blob/main/src/sound.js): `src/sound.js`
- [Sound effects](https://github.com/ssv32/game-js-find250diff/tree/main/assets/sounds): `assets/sounds`

### Browser services

- **Saved progress**
- **Yandex Games SDK**

### Other components

- **Player**

## Connections

- Player → Menu controls: chooses actions (evidence: `README.md`)
- Player → Level gameplay: finds differences (evidence: `README.md`)
- Level gameplay → Level definitions: selects level (evidence: `src/main.js`)
- Level gameplay → Level artwork: loads artwork (evidence: `src/main.js`)
- Level gameplay → Canvas rendering: renders and checks (evidence: `src/main.js`)
- Level gameplay → Level outcomes: updates outcomes (evidence: `src/main.js`)
- Level gameplay → Sound playback: plays effects (evidence: `src/main.js`)
- Menu controls → Level gameplay: selects levels (evidence: `src/menu.js`)
- Menu controls → Sound playback: plays clicks (evidence: `src/menu.js`)
- Menu controls → Language content: uses translations (evidence: `src/menu.js`)
- Menu controls → Hint and rewards: opens hint flow (evidence: `src/menu.js`)
- Hint and rewards → Saved progress: saves hint count (evidence: `src/menu.js`)
- Level gameplay → Saved progress: reads saved values (evidence: `src/main.js`)
- Sound playback → Sound effects: loads effects (evidence: `src/sound.js`)
- Level gameplay → Yandex Games SDK: starts and stops play (evidence: `src/main.js`)
- Hint and rewards → Yandex Games SDK: requests rewarded ads (evidence: `src/menu.js`)
- Menu controls → Yandex Games SDK: requests fullscreen ads (evidence: `src/menu.js`)
