# jaanos-zsoldos/megye-tanulas architecture

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

- Interactive diagram: https://gitdiagram.com/jaanos-zsoldos/megye-tanulas
- Repository: https://github.com/jaanos-zsoldos/megye-tanulas

## Overview

Megye tanuló játék is a dependency-free browser game for learning Hungary’s counties and county seats through map-based exercises. The learner chooses one of five modes, places or selects an answer on the map, and receives immediate or batch evaluation, scoring, visual feedback, and a completion dialog. The graph separates the game’s documented domain stages from its data, geometry, and display-support layers. Several links are documented in the README; source excerpts show the data-loading, placement, and reset integrations, but not every app.js handler.

Main entry points: [`app.js`](https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/app.js) (Map rendering), [`index.html`](https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/index.html) (Game page), [`reset.js`](https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/reset.js) (Map reset), [`data.js`](https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/data.js) (County data loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gameplay["Game flow"]
  node_mode_flow["Mode selection<br/>[app.js]"]
  node_game_state["Game state<br/>[app.js]"]
  node_map_rendering["Map rendering<br/>[app.js]"]
  node_answer_check["Answer evaluation<br/>[app.js]"]
  node_scoring["Scoring and completion<br/>[app.js]"]
  node_answer_feedback["Answer feedback<br/>[app.js]"]
end

subgraph group_mapdata["Map and data"]
  node_county_loader["County data loader<br/>[data.js]"]
  node_county_shapes["County and seat data<br/>[counties.json]"]
  node_placement_geometry["Placement geometry<br/>[placement.js]"]
end

subgraph group_display["Display support"]
  node_map_reset["Map reset<br/>[reset.js]"]
  node_map_layout["Map appearance<br/>[layout.js]"]
  node_viewport_fit["Viewport fitting<br/>[viewport.js]"]
  node_map_zoom["Map zoom<br/>[zoom.js]"]
end

subgraph group_interface["Static interface"]
  node_page["Game page<br/>[index.html]"]
  node_base_styles["Base styles<br/>[styles.css]"]
  node_responsive_styles["Responsive styles<br/>[responsive.css]"]
end

node_learner(("Learner"))

node_learner -->|"uses"| node_page
node_page -->|"selects mode"| node_mode_flow
node_mode_flow -->|"sets mode"| node_game_state
node_mode_flow -->|"starts round"| node_map_rendering
node_map_rendering -->|"uses loaded data"| node_county_loader
node_county_loader -->|"fetches and validates"| node_county_shapes
node_learner -->|"interacts with map"| node_map_rendering
node_map_rendering -->|"resolves positions"| node_placement_geometry
node_map_rendering -->|"handles answers"| node_answer_check
node_answer_check -->|"records placements"| node_game_state
node_answer_check -->|"evaluates answers"| node_scoring
node_scoring -->|"shows result"| node_answer_feedback
node_answer_feedback -->|"plays and displays feedback"| node_learner
node_scoring -->|"opens completion dialog"| node_page
node_mode_flow -->|"resets on restart"| node_map_reset
node_map_reset -->|"resets zoom"| node_map_zoom
node_map_reset -->|"refits viewport"| node_viewport_fit
node_map_rendering -.->|"restores appearance"| node_map_layout
node_page -->|"styled by"| node_base_styles
node_page -->|"adapted by"| node_responsive_styles
node_learner -->|"zooms map"| node_map_zoom

click node_page "https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/index.html"
click node_base_styles "https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/styles.css"
click node_responsive_styles "https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/responsive.css"
click node_mode_flow "https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/app.js"
click node_game_state "https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/app.js"
click node_map_rendering "https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/app.js"
click node_answer_check "https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/app.js"
click node_scoring "https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/app.js"
click node_answer_feedback "https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/app.js"
click node_county_loader "https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/data.js"
click node_county_shapes "https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/counties.json"
click node_placement_geometry "https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/placement.js"
click node_map_reset "https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/reset.js"
click node_map_layout "https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/layout.js"
click node_viewport_fit "https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/viewport.js"
click node_map_zoom "https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/zoom.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_mode_flow,node_game_state,node_map_rendering,node_answer_check,node_scoring,node_answer_feedback toneBlue
class node_county_loader,node_county_shapes,node_placement_geometry toneAmber
class node_map_reset,node_map_layout,node_viewport_fit,node_map_zoom toneMint
class node_page,node_base_styles,node_responsive_styles toneRose
class node_learner toneIndigo
```

## Components

### Game flow

- [Mode selection](https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/app.js): `app.js`
- [Game state](https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/app.js): `app.js`
- [Map rendering](https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/app.js): `app.js`
- [Answer evaluation](https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/app.js): `app.js`
- [Scoring and completion](https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/app.js): `app.js`
- [Answer feedback](https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/app.js): `app.js`

### Map and data

- [County data loader](https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/data.js): `data.js`
- [County and seat data](https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/counties.json): `counties.json`
- [Placement geometry](https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/placement.js): `placement.js`

### Display support

- [Map reset](https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/reset.js): `reset.js`
- [Map appearance](https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/layout.js): `layout.js`
- [Viewport fitting](https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/viewport.js): `viewport.js`
- [Map zoom](https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/zoom.js): `zoom.js`

### Static interface

- [Game page](https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/index.html): `index.html`
- [Base styles](https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/styles.css): `styles.css`
- [Responsive styles](https://github.com/jaanos-zsoldos/megye-tanulas/blob/main/responsive.css): `responsive.css`

### Other components

- **Learner**

## Connections

- Learner → Game page: uses (evidence: `README.md`)
- Game page → Mode selection: selects mode (evidence: `README.md`)
- Mode selection → Game state: sets mode (evidence: `README.md`)
- Mode selection → Map rendering: starts round (evidence: `README.md`)
- Map rendering → County data loader: uses loaded data (evidence: `app.js`)
- County data loader → County and seat data: fetches and validates (evidence: `data.js`)
- Learner → Map rendering: interacts with map (evidence: `README.md`)
- Map rendering → Placement geometry: resolves positions (evidence: `app.js`)
- Map rendering → Answer evaluation: handles answers (evidence: `README.md`)
- Answer evaluation → Game state: records placements (evidence: `README.md`)
- Answer evaluation → Scoring and completion: evaluates answers (evidence: `README.md`)
- Scoring and completion → Answer feedback: shows result (evidence: `README.md`)
- Answer feedback → Learner: plays and displays feedback (evidence: `README.md`)
- Scoring and completion → Game page: opens completion dialog (evidence: `README.md`)
- Mode selection → Map reset: resets on restart (evidence: `README.md`)
- Map reset → Map zoom: resets zoom (evidence: `reset.js`)
- Map reset → Viewport fitting: refits viewport (evidence: `reset.js`)
- Map rendering → Map appearance: restores appearance
- Game page → Base styles: styled by (evidence: `README.md`)
- Game page → Responsive styles: adapted by (evidence: `README.md`)
- Learner → Map zoom: zooms map (evidence: `README.md`)
